Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my code
Python
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()


What I have tried:

i try with python networkx and matplotlib and numpy
Posted
Updated 16-Oct-16 3:50am
v3
Comments
Suvendu Shekhar Giri 17-Oct-16 4:56am    
"i try with python networkx and matplotlib and numpy"
faced any issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900