Networkx experiment

# -*- coding: utf-8 -*-
“””
Created on Wed Aug 31 23:39:02 2011

@author: Wu Lingfei
“””

import networkx as nx
import matplotlib.pyplot as plt
G=nx.read_weighted_edgelist(“D:/research/www traffic network/flowweb980.csv”,
comments=’#’, delimiter=’,’, create_using=None,
nodetype=None, encoding=’utf-8′)
pos=nx.spring_layout(G)
n = G.number_of_edges()
colors=range(n)
#nx.draw_random(G,,alpha=0.5,node_color=”blue”, with_labels=False)
nx.draw(G,pos,node_size=10,node_color=’#A0CBE2′,edge_color=colors,width=1,
edge_cmap=plt.cm.Blues,with_labels=False)
#plt.savefig(“edge_colormap.png”) # save as png
plt.show() # display

Leave a Reply