igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] simple subgraph problem


From: Tamas Nepusz
Subject: Re: [igraph] simple subgraph problem
Date: Wed, 3 Sep 2008 16:06:39 +0100

Hi,

I have a network with multiple edges (different color for each type).
I was wondering how to subgraph from the whole network only nodes
with, say, green edges...
I'd do it as follows:
- create a copy of the graph
- find the edges that do NOT have the given colour
- remove these edges from the copy

In Python, you can do something like:

g2=g.copy()
g2.delete_edges(g2.es.select(color_ne="red"))

In R, delete.edges returns a new graph object, so it does the copying for you:

g2 <- delete.edges(g, E(g)[color != "red"])

--
T.





reply via email to

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