I have a list
of directed edges:
list={1 \[DirectedEdge] 1, 1 \[DirectedEdge] 10, 2 \[DirectedEdge] 2,
3 \[DirectedEdge] 3, 3 \[DirectedEdge] 5, 3 \[DirectedEdge] 7,
3 \[DirectedEdge] 8, 3 \[DirectedEdge] 9, 3 \[DirectedEdge] 11,
4 \[DirectedEdge] 4, 5 \[DirectedEdge] 2, 5 \[DirectedEdge] 5,
5 \[DirectedEdge] 7, 5 \[DirectedEdge] 8, 5 \[DirectedEdge] 9,
5 \[DirectedEdge] 11, 5 \[DirectedEdge] 14, 6 \[DirectedEdge] 1,
6 \[DirectedEdge] 2, 6 \[DirectedEdge] 4, 6 \[DirectedEdge] 5,
6 \[DirectedEdge] 6, 6 \[DirectedEdge] 7, 6 \[DirectedEdge] 8,
6 \[DirectedEdge] 9, 6 \[DirectedEdge] 10, 6 \[DirectedEdge] 11,
6 \[DirectedEdge] 12, 6 \[DirectedEdge] 13, 6 \[DirectedEdge] 14,
6 \[DirectedEdge] 15, 6 \[DirectedEdge] 16, 6 \[DirectedEdge] 17,
7 \[DirectedEdge] 7, 7 \[DirectedEdge] 9, 8 \[DirectedEdge] 8,
8 \[DirectedEdge] 9, 8 \[DirectedEdge] 11, 8 \[DirectedEdge] 14,
8 \[DirectedEdge] 16, 8 \[DirectedEdge] 17, 9 \[DirectedEdge] 9,
10 \[DirectedEdge] 9, 10 \[DirectedEdge] 10, 11 \[DirectedEdge] 2,
11 \[DirectedEdge] 8, 11 \[DirectedEdge] 9, 11 \[DirectedEdge] 11,
11 \[DirectedEdge] 15, 11 \[DirectedEdge] 16, 11 \[DirectedEdge] 17,
12 \[DirectedEdge] 9, 12 \[DirectedEdge] 12, 13 \[DirectedEdge] 9,
13 \[DirectedEdge] 13, 13 \[DirectedEdge] 16, 13 \[DirectedEdge] 17,
14 \[DirectedEdge] 14, 15 \[DirectedEdge] 9, 15 \[DirectedEdge] 15,
16 \[DirectedEdge] 9, 16 \[DirectedEdge] 16, 17 \[DirectedEdge] 17};
I want to draw a histogram in the following structure. The list
above consists of In- and Out-links, and I like to construct a histogram combining both In and Out link numbers with different colors in the bars of the histogram. For example, if 5 links go out of vertex 1 and 10 links come in to vertex 1, the bar associated with vertex 1 should have a height of 15. But then, I should be able to see the bars in two colors to visualize the In and Out sample.
I know that Degree
, InDegree
and OutDegree
are the related functions for calculating the data that will be used in constructing the histogram, but I have no idea how I put them in the above structure.
The ideal (limited with my knowledge) solution is to write a Mathematica
function, the argument of which is a list of directed edges.
Thank you for your time.