65 |
|
|
66 |
def __init__(self, startVertex, endVertex, maxdepth, color_map): |
def __init__(self, startVertex, endVertex, maxdepth, color_map): |
67 |
|
|
68 |
#print dir(self) |
print dir(self) |
69 |
|
|
70 |
#bgl.dfs_visitor.__init__(self) |
#bgl.dfs_visitor.__init__(self) |
71 |
#self.name_map = name_map |
#self.name_map = name_map |
90 |
self.level = 0 |
self.level = 0 |
91 |
|
|
92 |
|
|
93 |
#def back_edge(self, e, g): |
def back_edge(self, e, g): |
94 |
# self.tree_edge(e, g, 'back_edge') |
self._touch_edge(e, g, 'back_edge') |
95 |
|
|
96 |
#def forward_or_cross_edge(self, e, g): |
def forward_or_cross_edge(self, e, g): |
97 |
# self.tree_edge(e, g, 'forward_or_cross_edge') |
self._touch_edge(e, g, 'forward_or_cross_edge') |
98 |
|
|
99 |
#def tree_edge(self, e, g): |
def tree_edge(self, e, g): |
100 |
# self.tree_edge(e, g, 'examine_edge') |
self._touch_edge(e, g, 'tree_edge') |
101 |
|
|
102 |
def examine_edge(self, e, g): |
def examine_edge(self, e, g): |
103 |
self._touch_edge(e, g, 'examine_edge') |
self._touch_edge(e, g, 'examine_edge') |
122 |
name_map = g.vertex_properties['node_id'] |
name_map = g.vertex_properties['node_id'] |
123 |
|
|
124 |
if label: |
if label: |
125 |
print "%s:" % label, |
print "%s:\t" % label, |
126 |
print "edge ", |
#print "edge ", |
127 |
print name_map[u], |
print name_map[u], |
128 |
print " -> ", |
print " -> ", |
129 |
print name_map[v] |
print name_map[v] |
143 |
print self.current_path |
print self.current_path |
144 |
self.paths.append(self.current_path) |
self.paths.append(self.current_path) |
145 |
self.current_path = [] |
self.current_path = [] |
146 |
|
|
147 |
|
|
148 |
|
def _touch_vertex(self, v, g, label=''): |
149 |
|
name_map = g.vertex_properties['node_id'] |
150 |
|
id = name_map[v] |
151 |
|
print '%s:\t%s' % (label, id) |
152 |
|
|
153 |
|
|
154 |
|
def start_vertex(self, v, g): |
155 |
|
self._touch_vertex(v, g, 'start_vertex') |
156 |
|
|
157 |
|
def discover_vertex(self, v, g): |
158 |
|
self._touch_vertex(v, g, 'discover_vertex') |
159 |
|
|
160 |
|
def initialize_vertex(self, v, g): |
161 |
|
self._touch_vertex(v, g, 'initialize_vertex') |
162 |
|
|
163 |
|
def examine_vertex(self, v, g): |
164 |
|
self._touch_vertex(v, g, 'examine_vertex') |
165 |
|
|
166 |
|
def finish_vertex(self, v, g): |
167 |
|
self._touch_vertex(v, g, 'finish_vertex') |
168 |
|
|
169 |
|
|
170 |
""" |
""" |
171 |
def start_vertex(self, v, g): |
def start_vertex(self, v, g): |
235 |
e3 = graph.add_edge(v3, v4) |
e3 = graph.add_edge(v3, v4) |
236 |
|
|
237 |
e4 = graph.add_edge(v1, v4) |
e4 = graph.add_edge(v1, v4) |
238 |
#e5 = graph.add_edge(v3, v2) |
e5 = graph.add_edge(v2, v3) |
239 |
#e6 = graph.add_edge(v2, v4) |
#e6 = graph.add_edge(v2, v4) |
240 |
|
|
241 |
""" |
""" |