<jupyter_start><jupyter_text><jupyter_code>import networkx as nx
import matplotlib.pyplot as plt
vertices = range(1, 10)
edges =  [(7,2), (2,3), (7,4), (4,5), (7,3), (7,5), (1,6),(1,7),(2,8),(2,9)]
G = nx.Graph()
G.add_nodes_from(vertices)
G.add_edges_from(edges)
nx.draw(G, with_labels=True, node_color= 'y', node_size=800)


nx.degree_centrality(G)
nx.betweenness_centrality(G)
nx.closeness_centrality(G)
centrality = nx.eigenvector_centrality(G)
sorted((v, '{:0.3f}'.format(c)) for v,c in centrality.items())<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup