Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import networkx as nx
- import pylab as plt
- from collections import Counter
- webg = nx.read_edgelist('web-graph.txt',create_using=nx.DiGraph(),nodetype=int)
- in_degrees = webg.in_degree()
- in_values = sorted(set(in_degrees.values()))
- #in_hist = [in_degrees.values().count(x)for x in in_values]
- in_hist = Counter(in_degrees.values())
- plt.figure()
- plt.grid(True)
- plt.plot(in_values,in_hist,'ro-')
- plt.plot(out_values,out_hist,'bv-')
- plt.legend(['in-degree','Out-degree'])
- plt.xlabel('Degree')
- plt.ylabel('Number of nodes')
- plt.title('web graph degree')
- plt.xlim([0,2*10**2])
- plt.savefig('/home/alireza/web-graph-degree.pdf')
- plt.close()
Add Comment
Please, Sign In to add comment