Commit 3fea60ff authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix problem with filtered graph in graph_draw()

It is not useful to store vertices by index when the vertices are being
filtered, since Graph.vertex() does not map to index in this case.
parent 5c935bdd
......@@ -384,14 +384,15 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
gv.setv(n, k, str(val[v]))
gv.setv(n, k, str(val))
nodes[g.vertex_index[v]] = n
nodes[v] = n
for e in g.edges():
ge = gv.edge(nodes[g.vertex_index[e.source()]],
ge = gv.edge(nodes[e.source()],
gv.setv(ge, "arrowsize", "0.3")
if g.is_directed():
gv.setv(ge, "arrowhead", "vee")
# apply color
if ecolor != None:
if isinstance(ecolor,str):
......@@ -430,8 +431,8 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
for n, n_gv in nodes.iteritems():
p = gv.getv(n_gv, "pos")
p = p.split(",")
pos[0][g.vertex(n)] = float(p[0])
pos[1][g.vertex(n)] = float(p[1])
pos[0][n] = float(p[0])
pos[1][n] = float(p[1])
if output_format == "auto":
if output == "":
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment