This is a silly question, but I just can't see how to do it in the igraph documentation. It will be very simple I imagine, but my python isn't good enough to work it out.
using igraph, I am finding the edge I want to play with using select. It returns a reference to the edge object. When I try to change the edge_width attribute it isn't being updated in the plot.
My code example is looking for the edge between vertices A and B.
source = g.vs.find(name = 'A')
sink = g.vs.find(name = 'B')
edge = g.es.select(_source = source, _target= sink)
edge["edge_width"] = 20
But when I plot the graph, all edges are the same. What am I doing wrong?
EDIT: To make life easier, here is a full code example that generates the issue. It simply creates a graph with 5 nodes, A to E, fully connected to each other and plots it to screen.
import string
import igraph as ig
num_nodes = 5
alpha_list = list(string.ascii_uppercase)
alpha_list = alpha_list[:num_nodes]
g = ig.Graph()
g.add_vertices(alpha_list)
for x in range (0, num_nodes + 1):
for y in range (x, num_nodes):
print "x: "+str(x)+", y: "+str(y)
if (x != y):
g.add_edge(x, y)
g.vs["label"] = g.vs["name"]
source = g.vs.find(name = 'A')
sink = g.vs.find(name = 'B')
edge = g.es.select(_source = source, _target= sink)
edge["edge_width"] = 20
print edge.attributes()
layout = g.layout("circle")
ig.plot(g, layout = layout)
edge_widthattribute in your example; you should be usingwidthinstead, as you correctly do in your updated answer. - Tamás