# Sort lists of vertices {indegrees, outdegrees} by indegree

in = VertexInDegree[F];
out = VertexOutDegree[F];


I want both in and out to be ordered by in. Example: graph has nodes a,b,c with indegrees 1,2,0 and outdegrees 0,1,2. I want lists in = {0,1,2} and out = {2,0,1}.

How do I do this? I tried

in = Sort[VertexInDegree[F]];
out = VertexOutDegree[F][[Ordering@in]];


, but this didn't give the expected result.

-
You want to use Ordering on the data before sorting. Try out = VertexOutDegree[F][[Ordering@VertexInDegree[F]]]. –  Rahul Narain May 19 at 16:53

g = RandomGraph[BernoulliGraphDistribution[10, 0.2], DirectedEdges -> True];