CoCalc Public Fileswilliamgraph / will.sagewsOpen with one click!
Author: Kevin Lui
Views : 50
Compute Environment: Ubuntu 18.04 (Deprecated)
import re import glob mod_path = 'modular/' D = DiGraph() # add vertices all_py = glob.glob(mod_path+'*/all.py') Vs = [x.split('/')[-2] for x in all_py] for V in Vs: D.add_vertex(V) # add edges for V in Vs: for s in glob.glob(mod_path+V+'/*'): with open(s,'r') as f: for l in f: if re.match('from sage.modular', l): B = l.split(' ')[1].split('.')[2] if B in Vs: D.add_edge(V, B) show(D) D.plot()
d3-based renderer not yet implemented