Generate OpenIOC Chart

Felix Barbalet
2017-09-10T20:08:14Z

create_chart.py

| from graphviz import Digraph
| edges = set()
|
| dot = Digraph(graph_attr={
| 'overlap':'false',
| 'outputorder':'edgesfirst'
| })
|
| ioc = dot.node('OpenIOC')
|
| with open('terms.csv') as terms:
| for line in terms:
| entries = line.strip().split('/')
| if entries[0] in edges:
| continue
|
| node = dot.node(entries[0], style='filled', shape="box")
| dot.edge('OpenIOC', entries[0])
| edges.add(entries[0])
| continue
| last = entries[0]
| for e in entries[1:]:
| edge = '{}/{}'.format(last, e)
| if edge in edges:
| continue
| node = dot.node(e, style='filled', shape='box')
| dot.edge(last, e)
| last = e
| edges.add(edge)
|
| dot.save('graph.gv')