  The widespread relevance of increasingly complex networks requires methods to
extract meaningful coarse-grained representations of such systems. For
undirected graphs, standard community detection methods use criteria largely
based on density of connections to provide such representations. We propose a
method for grouping nodes in directed networks based on the role of the nodes
in the network, understood in terms of patterns of incoming and outgoing flows.
The role groupings are obtained through the clustering of a similarity matrix,
formed by the distances between feature vectors that contain the number of in
and out paths of all lengths for each node. Hence nodes operating in a similar
flow environment are grouped together although they may not themselves be
densely connected. Our method, which includes a scale factor that reveals
robust groupings based on increasingly global structure, provides an
alternative criterion to uncover structure in networks where there is an
implicit flow transfer in the system. We illustrate its application to a
variety of data from ecology, world trade and cellular metabolism.
