|
From: | Ahmed Abdeen Hamed |
Subject: | Re: [igraph] Loading graph from files |
Date: | Fri, 15 Nov 2013 15:34:34 -0500 |
Hi, I think csv is not directly supported, although probably only 3lines of code after you have the edge list.CSV files can probably be read with Python’s csv.DictReader class (from the CSV module) combined with igraph.Graph.DictList():import csvimport igraphreader = csv.DictReader(open(“file.csv”), dialect=“excel”)g = igraph.Graph.DictList(edges=reader)This assumes that the CSV file contains column headers and the columns named “source” and “target” contain the source and target vertex names. If your columns are named differently, use the edge_foreign_keys=… keyword argument of Graph.DictList.—T.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |