Generated detailed connection graph, also output to PNG
This commit is contained in:
parent
067922e71e
commit
c5c8f2d754
5
cli.py
5
cli.py
|
@ -146,10 +146,11 @@ def init_cli_connections():
|
||||||
# TODO: this requires graphing libraries
|
# TODO: this requires graphing libraries
|
||||||
@click.command()
|
@click.command()
|
||||||
def graph():
|
def graph():
|
||||||
g = xs.connection_graph()
|
#g = xs.connection_graph()
|
||||||
|
g = xs.detailed_connection_graph()
|
||||||
|
|
||||||
nx.write_dot(g, 'graph.dot')
|
nx.write_dot(g, 'graph.dot')
|
||||||
subprocess.call(['dot', '-Tps', 'graph.dot', '-o', 'graph.ps'])
|
subprocess.call(['dot', '-Tpng', 'graph.dot', '-o', 'graph.png'])
|
||||||
|
|
||||||
# Matplotlib
|
# Matplotlib
|
||||||
#pos = nx.spring_layout(g)
|
#pos = nx.spring_layout(g)
|
||||||
|
|
14
x/signals.py
14
x/signals.py
|
@ -166,3 +166,17 @@ def connection_graph():
|
||||||
)
|
)
|
||||||
|
|
||||||
return g
|
return g
|
||||||
|
|
||||||
|
|
||||||
|
def detailed_connection_graph():
|
||||||
|
g = nx.MultiDiGraph()
|
||||||
|
|
||||||
|
for emitter_name, destination_values in CLIENTS.items():
|
||||||
|
for emitter_input, receivers in CLIENTS[emitter_name].items():
|
||||||
|
for receiver_name, receiver_input in receivers:
|
||||||
|
label = emitter_input
|
||||||
|
if emitter_input != receiver_input:
|
||||||
|
label = '{}:{}'.format(emitter_input, receiver_input)
|
||||||
|
g.add_edge(emitter_name, receiver_name, label=label)
|
||||||
|
|
||||||
|
return g
|
||||||
|
|
Loading…
Reference in New Issue