> I have a weighted network stored in a .csv file. I need to import  using a
> csv.DictReader but also apply the weights in the column to the edges as we
> import
Isn't it what DictReader does by default? All the key-value pairs that do not
correspond to the source and the target vertex in the dictionary iterator that
you pass to "edges" are imported as edge attributes. Maybe the only catch is
that you have to cast them to floats after you have created the graph because
the CSV reader reads them as strings -- so maybe you'll have to do this:

g.es["weight"] = [float(x) for x in g.es["weight"]]

-- 
T.

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to