- arc = "%s -> %s" % (loc[4:], dest[4:])
- label=",".join(verbs).lower()
- if len(label) > 0:
- arc += ' [label="%s"]' % label
- print(" " + arc)
+ links[(loc, dest)] = verbs
+
+ neighbors = set()
+ for loc in nodes:
+ for (f, t) in links:
+ if f == 'LOC_NOWHERE' or t == 'LOC_NOWHERE':
+ continue
+ if (f == loc and subset(t)) or (t == loc and subset(f)):
+ if loc not in neighbors:
+ neighbors.add(loc)
+
+ print("digraph G {")
+
+ for loc in nodes:
+ if not is_forwarder(loc):
+ node_label = roomlabel(loc)
+ if subset(loc):
+ print(' %s [shape=box,label="%s"]' % (loc[4:], node_label))
+ elif loc in neighbors:
+ print(' %s [label="%s"]' % (loc[4:], node_label))
+
+ # Draw arcs
+ for (f, t) in links:
+ arc = "%s -> %s" % (f[4:], t[4:])
+ label=",".join(links[(f, t)]).lower()
+ if len(label) > 0:
+ arc += ' [label="%s"]' % label
+ print(" " + arc)