summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-11 19:10:37 +0200
committerFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-11 19:10:37 +0200
commite6efa8f444b4e0b3d690b2d53586eca746e33859 (patch)
treee6b8728944f26feae8c2b03250448ee36bd7d883
parent3bad43f537e76336d47e598d47b5be3f1e105cf6 (diff)
digraph again
parse.py:now it can be distinguished between uni and bidirectional connections
-rwxr-xr-x.scripts/parse.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/.scripts/parse.py b/.scripts/parse.py
index 54f6c35d..27fe3a99 100755
--- a/.scripts/parse.py
+++ b/.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: