comparison python/graph.py @ 274:ea93e0a7a31e

Move docs
author Windel Bouwman
date Wed, 04 Sep 2013 17:35:06 +0200
parents cdc76d183bcc
children 046017431c6a
comparison
equal deleted inserted replaced
273:6b3a874edd6e 274:ea93e0a7a31e
24 # TODO 24 # TODO
25 pass 25 pass
26 26
27 def to_dot(self, f): 27 def to_dot(self, f):
28 """ Generate graphviz dot representation """ 28 """ Generate graphviz dot representation """
29 print('digraph G {', file=f) 29 #print('digraph G {', file=f)
30 for node in self.nodes: 30 for node in self.nodes:
31 print('{} [label="{}" shape=box3d];'.format(id(node), node), file=f) 31 print('{} [label="{}" shape=box3d];'.format(id(node), node), file=f)
32 for n, m in self.edges: 32 for n, m in self.edges:
33 print('{} -> {};'.format(id(n), id(m)), file=f) 33 print('{} -> {};'.format(id(n), id(m)), file=f)
34 print('}', file=f) 34 #print('}', file=f)
35 35
36 36
37 class Node: 37 class Node:
38 """ 38 """
39 Node in a graph. 39 Node in a graph.