Automatic exploration of structural regularities in networks