import networkx as nx
# read in the graph edge list
G = nx.read_edgelist("test.data")
# print out some of the graph's information
print(G.order())
print(G.size())
print(G.nodes)
print(G.adj)
# loop through each vertex in the graph
# loop through each vertex's neighbors
for n in G.nodes:
for e in G.neighbors(n):
print(n,e)
# visualize the graph using matplotlib
import matplotlib.pyplot as plt
nx.draw(G)
plt.show()