Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Created April 22, 2022 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/27742f8b524ec6ea834e740a354e7cbb to your computer and use it in GitHub Desktop.
Save Hermann-SW/27742f8b524ec6ea834e740a354e7cbb to your computer and use it in GitHub Desktop.
Planar drawing of C30 fullerene
#!/usr/bin/env python
import matplotlib.pyplot as plt
import networkx as nx
C30=[[9,10,1],[0,2,25],[1,18,3],[2,4,26],[3,16,5],[4,6,27],[5,14,7],[6,8,28],[7,12,9],[8,0,29],[0,11,19],[10,12,21],[11,8,13],[12,14,22],[13,6,15],[14,16,23],[15,4,17],[16,18,24],[17,2,19],[18,10,20],[19,21,24],[20,11,22],[21,13,23],[22,15,24],[23,17,20],[1,26,29],[25,3,27],[26,5,28],[27,7,29],[28,9,25]]
G = nx.Graph()
for i in range(len(C30)):
for j in C30[i]:
G.add_edge(i, j)
plt.figure(figsize=(8,6))
nx.draw_planar(G, with_labels=True)
plt.show()
@Hermann-SW
Copy link
Author

Mathplotlib graph drawing zoom in/out:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment