summaryrefslogtreecommitdiffstats
path: root/hosts
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
commitf64b0ee06c8bef0018b5717d37f2f16647ee1369 (patch)
tree07d78c02e527efef2b5f1550d8db501a365e0468 /hosts
parent644e1a588ec484728c9dffb0ad5a4b38e947c467 (diff)
digraph again
parse.py:now it can be distinguished between uni and bidirectional connections
Diffstat (limited to 'hosts')
-rwxr-xr-xhosts/.scripts/parse.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/hosts/.scripts/parse.py b/hosts/.scripts/parse.py
index 54f6c35d..27fe3a99 100755
--- a/hosts/.scripts/parse.py
+++ b/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: