H = nx.Graph(G) # create a new graph using connections from Gedgelist = [(0, 1), (1, 2), (2, 3)]H = nx.Graph(edgelist) # create a graph from an edge listadjacency_dict = {0: (1, 2), 1: (0, 2), 2: (0, 1)}# create a graph specifying node name and the nodes it connects toH = nx.Graph(adjacency_dict)
import matplotlib.pyplot as pltoptions = { "font_size": 36, "node_size": 3000, "node_color": "white", "edgecolors": "black", "linewidths": 5, "width": 5,}# Draw the graph at the end with options (optional)nx.draw_networkx(G, **options)ax = plt.gca()ax.margins(0.20) # may need to set marginsplt.axis("off") # disable axisplt.show()