Another tool we have for analyzing a network is the degree distribution or the plotting of the number of nodes having a particular degree. In Figure 1.3, B, E, G, H, and I have a degree of three, A, C, and F have a degree of four, and D has a degree of five.
Figure 1.5 shows a degree distribution reflecting the graph in Figure 1.3. On the vertical axis is the number of nodes that have a degree that is plotted on the horizontal axis. Thus, there are five nodes with degree three plotted corresponding to a degree of three, three nodes of degree four plotted corresponding to degree four, and one node of degree five corresponding to degree five on the horizontal axis.
\[ \usepackage{pgfplots} \begin{tikzpicture} \begin{axis}[ x tick label style={ /pgf/number format/1 sep=}, ylabel=Number of Nodes, enlargelimits=0.05, legend style={at={(0.5,-0.1)}, anchor=north,legend columns=-1}, ybar interval=0.7, ] \addplot coordinates {(0,0),(1,0),(2,0),(3,5) (4,3) (5,1)}; \legend{Degree} \end{axis} \end{tikzpicture} \]
While this is a pretty straight forward process, degree distributions are incredibly important for helping to analyze large networks.
Creating a degree distribution for a directed graph is a more difficult task, as two different distributions need to be created, one for the in-degree distribution and another for the out-degree distribution. Figure 1.7 shows the in-degree and out-degree distributions of the graph in Figure 1.4.
Indegree, 2, 1, 2, 2 Out-degree 0, 3, 4, 0