igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] subgraph from edge seq


From: Tamas Nepusz
Subject: Re: [igraph] subgraph from edge seq
Date: Mon, 10 Nov 2008 12:09:27 +0000

> Hi, a simple question:
> Is it possible in igraph for Python to construct a subgraph fron an edge
> sequence of a graph? 
Not yet. The easiest way to achieve this is to collect the vertices
participating in the edge sequence and then call subgraph() on the
vertex set:

def adj(es):
     result = set()
     for e in es: result.add(*e.tuple)
     return list(result)

g2 = g.subgraph(adj(your_edge_sequence))

-- 
Tamas






reply via email to

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