diff options
author | Felix Richter <Felix.Richter@syntax-fehler.de> | 2011-05-11 19:10:37 +0200 |
---|---|---|
committer | Felix Richter <Felix.Richter@syntax-fehler.de> | 2011-05-11 19:10:37 +0200 |
commit | a9eead46d8fc651e99e9e74e71f5135853bbdd72 (patch) | |
tree | 06f9e51644ab294f63d55576baed240c711790cf /retiolum/hosts/.scripts | |
parent | 6b447449eed7aa99a8a18e3de30566545af0edcd (diff) |
digraph again
parse.py:now it can be distinguished between uni and bidirectional connections
Diffstat (limited to 'retiolum/hosts/.scripts')
-rwxr-xr-x | retiolum/hosts/.scripts/parse.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/retiolum/hosts/.scripts/parse.py b/retiolum/hosts/.scripts/parse.py index 54f6c35d..27fe3a99 100755 --- a/retiolum/hosts/.scripts/parse.py +++ b/retiolum/hosts/.scripts/parse.py @@ -8,7 +8,7 @@ def write_digraph(nodes): """ writes the complete digraph in dot format """ - print ('graph retiolum {') + print ('digraph retiolum {') print (' node[shape=box,style=filled,fillcolor=grey]') generate_stats(nodes) merge_edges(nodes) @@ -31,6 +31,7 @@ def merge_edges(nodes): for i,secon in enumerate(nodes[con['name']].get('to',[])): if k == secon['name']: del (nodes[con['name']]['to'][i]) + con['bidirectional'] = True def write_node(k,v): @@ -46,8 +47,11 @@ def write_node(k,v): node += "]" print (node) for con in v.get('to',[]): - print " "+k+ " -- " +con['name'] + "[weight="+str(10/float(con['weight']))+"]" - + edge = " "+k+ " -> " +con['name'] + "[weight="+str(10/float(con['weight'])) + if con.get('bidirectional',False): + edge += ",dir=both" + edge += "]" + print edge def parse_input(): nodes={} for line in sys.stdin: |