Mercurial > lcfOS
comparison python/ppci/codegen/graph.py @ 312:2c9768114877
Added cool logging formatter
author | Windel Bouwman |
---|---|
date | Mon, 16 Dec 2013 17:58:15 +0100 |
parents | 6753763d3bec |
children | e9fe6988497c |
comparison
equal
deleted
inserted
replaced
311:ff665880a6b0 | 312:2c9768114877 |
---|---|
32 return set(m for m in self.nodes if self.hasEdge(n, m)) | 32 return set(m for m in self.nodes if self.hasEdge(n, m)) |
33 | 33 |
34 def to_dot(self, f): | 34 def to_dot(self, f): |
35 """ Generate graphviz dot representation """ | 35 """ Generate graphviz dot representation """ |
36 for n in self.nodes: | 36 for n in self.nodes: |
37 print('{} [label="{}" shape=box3d];'.format(id(n), n), file=f) | 37 print(' {} [label="{}" shape=box3d];'.format(id(n), n), file=f) |
38 for n, m in self.edges: | 38 for n, m in self.edges: |
39 print('{} -> {};'.format(id(n), id(m)), file=f) | 39 print(' {} -> {};'.format(id(n), id(m)), file=f) |
40 | 40 |
41 | 41 |
42 class Node: | 42 class Node: |
43 """ | 43 """ |
44 Node in a graph. | 44 Node in a graph. |