Practice Mining the Social Web Book
In [19]:
import networkx as nx
g = nx.Graph()
g.add_edge(1,2)
g.add_node("spam")
print g.nodes()
In [20]:
print g.edges()
In [21]:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
nx.draw(g)
plt.show()
In [22]:
plt.savefig("1stgraph.png", dpi=100)