Degree summarizes the number of edges for each node in a graph
.. [1] JD Power, B Schlaggar, CN Lessov-Schlaggar, SE Petersen, "Evidence for Hubs in Human Functional Brain Networks" Neuron Volume 79, Issue 4, 21 August 2013, Pages 798–813 http://dx.doi.org/10.1016/j.neuron.2013.07.035
In [1]:
%matplotlib inline
In [2]:
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
In [7]:
mat_100 = np.random.random((100,100))
mat_100[mat_100 < 0.7] = 0
mat_100 = np.triu(mat_100, k=1)
plt.imshow(mat_100, interpolation = 'nearest', vmin=0, vmax=1)
plt.colorbar()
Out[7]:
In [13]:
graph_100 = nx.from_numpy_matrix(mat_100)
degree_100 = graph_100.degree().values()
In [17]:
mat_500 = np.random.random((500,500))
mat_500[mat_500 < 0.7] = 0
mat_500 = np.triu(mat_500, k=1)
plt.imshow(mat_500, interpolation = 'nearest', vmin=0, vmax=1)
plt.colorbar()
Out[17]:
In [18]:
graph_500 = nx.from_numpy_matrix(mat_500)
degree_500 = graph_500.degree().values()
In [23]:
plt.hist((degree_100, degree_500), bins=25 )
Out[23]: