I added the directed attribute to the args list and it worked :-)

 g = igraph.Graph.DictList(vertices=None, edges=reader, directed=True)

a complete guess ;)

-Ahmed


On Fri, Nov 15, 2013 at 3:44 PM, Ahmed Abdeen Hamed <[email protected]
> wrote:

> Thanks very much for the blazing fast responses. You guys are the best!
> Where do you guys get so much knowledge? ;)
>
> How to specify that the graph is directed?
>
> Sorry I am trying to get a good grip of Python and igraph at the same time.
>
> -Ahmed
>
>
>
> On Fri, Nov 15, 2013 at 3:38 PM, Tamás Nepusz <[email protected]> wrote:
>
>>  Sorry; it should be:
>>
>> g = igraph.Graph.DictList(vertices=None, edges=reader)
>>
>> since you have no other CSV file that would specify the names and
>> properties of the vertices.
>>
>> --
>> T.
>>
>> On Friday, 15 November 2013 at 21:34, Ahmed Abdeen Hamed wrote:
>>
>> Thank you!
>>
>> I am getting this error:
>>
>> >>> g = igraph.Graph.DictList(edges=reader)
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>> TypeError: DictList() takes at least 3 arguments (2 given)
>>
>> Here is how my file looks like:
>>
>> source,target
>> tums,zantac
>>
>> Thanks again!
>>
>> -Ahmed
>>
>>
>>
>> On Fri, Nov 15, 2013 at 2:02 PM, Tamás Nepusz <[email protected]> wrote:
>>
>> Hi, I think csv is not directly supported, although probably only 3
>> lines 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 csv
>> import igraph
>>
>> reader = 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
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to