igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] subtraction?


From: Tamas Nepusz
Subject: Re: [igraph] subtraction?
Date: Thu, 21 May 2009 11:54:36 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

> I have a graph g built in some way (basically random graphs, different
> models), and a graph h which is the kcore(k) [for one k in N] of g.
> 
> I use python, btw.
> 
> I am not sure I understood the use of subgraph here....
Here's an example. First we generate a graph somehow:

>>> g = Graph.GRG(100, 0.2)

Then we get the k-core indices for each vertex:

>>> g.vs["coreness"] = g.coreness()

We construct h s.t. the coreness index should be greater than or equal
to 4 for all vertex in h:

>>> h = g.subgraph(g.vs.select(coreness_ge=4))

Now, since we know that all the vertices in h are those that have a
coreness index of at least 4, we know that the rest must have coreness
less index of less than 4, so we can select those from g as well:

>>> g2 = g.subgraph(g.vs.select(coreness_lt=4))

Hope this helps.

-- 
Tamas

Attachment: pgpRvaYHuP1Jc.pgp
Description: PGP signature


reply via email to

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