import matplotlib.pyplot as plt
1.1 1.3 2.1 2.2 2.3 3.1 3.3 5.1 5.3
1.3 1.2 2.1 2.2 2.4 5.1 5.3
2.3 1.3 2.5 3.3 4.3 5.1 5.3
2.5 1.3 2.4 3.3 4.3 5.1 5.2 5.3
3.3 2.1 2.4 2.5 3.1 3.2 4.3
4.4 4.2 4.3 5.1 5.2 5.3 5.4
4.5 1.2 1.3 2.1 2.2 2.3 2.4 3.3 4.1 4.3
4.8 1.1 1.2 1.3 2.1 2.4 3.3 4.1 4.3 4.5 4.7 5.3 6.2 6.3
5.1 1.2 1.3 4.3 4.4 4.7 4.8
5.3 1.1 1.2 2.1 3.2 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 5.4
5.5 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8
for line in edges.split("\n"):
graph.add_edge(node, label)
# color by first digit of the label
colors = [int(node[0]) for node in graph.nodes()]
# find graph layout using graphviz
positions = networkx.graphviz_layout(graph, "twopi")
networkx.draw_networkx_nodes(graph, positions, node_size=600, node_color=colors, cmap=plt.cm.Paired)
networkx.draw_networkx_edges(graph, positions, alpha=0.2, edge_color="#000000")
networkx.draw_networkx_labels(graph, positions)
xmax = 1.05 * max(positions.values(), key=lambda x: x[0])[0]
ymax = 1.05 * max(positions.values(), key=lambda x: x[1])[1]
plt.gcf().set_facecolor("w")