[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Extracting sub-graph
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Extracting sub-graph |
Date: |
Wed, 12 Oct 2011 15:43:16 +0200 |
>> Have you imported the "WEAK" constant from the igraph module before? (from
>> igraph import WEAK)
> Nope, do I need to do that?
Yes. "WEAK" is just a constant that resolves to 1, so if you want mode=WEAK to
work, then you need to import that.
> Another issue, I use Read_Ncol() to import a large graph.
> For vertex attributes is there a similar function useful on large
> graph?
No, there isn't.
> Currently I simply loop through a list of vertices, and add the
> attributes that way, but it's slow.
You can assign attributes to a whole set of vertices like this:
g.vs["attr"] = value_list
where value_list is a list of attribute values to be assigned to the "attr"
attribute of all the vertices. This should be faster than doing something like:
for idx, value in enumerate(value_list):
g.vs[idx]["attr"] = value
--
T.
Re: [igraph] Extracting sub-graph, Tamás Nepusz, 2011/10/12