igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] uploading a bipartite graph from a csv file


From: Ahmed Abdeen Hamed
Subject: Re: [igraph] uploading a bipartite graph from a csv file
Date: Sun, 24 May 2015 21:19:27 -0400

Thank you very much! Just managed to get it done

Here is what I did

type_list = []
for vertex in g.vs:
if vertex["name"].startswith("#"):
  type_list.append(True)
  else:
  type_list.append(False)

g.vs["type"] = type_list

Perhaps not the best Python code but the projection returns the correct partitions!

BTW: do you guys keep track of the citations for the sake of funds? I am happy to provide a list of my own citations unless of course you have Google Scholar notifies you.

Thanks again,

-Ahmed



On Wed, May 20, 2015 at 3:17 PM, Tamas Nepusz <address@hidden> wrote:
> reader = csv.DictReader(open("bipartite-test.csv"), dialect="excel")
> g = igraph.Graph.DictList(vertices=None, edges=reader, directed=False)
>
> Now do I need to loop over the g.vs["type"] or there is a quicker way?
You need to produce a list of length g.vcount() where the i-th element is True
or False and then simply say:

g.vs["type"] = your_list

T.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]