igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] finding paths of given length


From: Gábor Csárdi
Subject: Re: [igraph] finding paths of given length
Date: Thu, 5 Apr 2012 09:31:05 -0400

Sorry for the delay! Answers below.

On Tue, Apr 3, 2012 at 11:16 AM, Sam Steingold <address@hidden> wrote:
>> * Sam Steingold <fqf-zKKw517/address@hidden> [2012-03-23 14:39:02 -0400]:
>>
>> given a digraph, how do I find all paths of given length?
>
> neighborhood() appears to be useful, except that it returned really a
> neighborhood, i.e., the vertexes reachable by <= N steps.
> What if I want the vertexes reachable in _EXACTLY_ N steps?

You mean shortest paths here? If yes, then you can calculate
shortest.paths() from a given starting vertex and see which vertices
are n steps away.

>> what if all the edges in the path must have the same attribute?

Then remove the rest of the edges from the graph first. Not
surprisingly this is exactly your next question. :)

> How do I create a subgraph with edges of a fixes specified attribute?

Select the edges and supply them to delete.edges. E.g. removing edges
under a weight threshold:

delete.edges( g, E(g)[ weight < 0.5 ] )

G.

[...]



reply via email to

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