Get all the dependant nodes or a root node in a new sub-graph

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Get all the dependant nodes or a root node in a new sub-graph

josubg
Hi everybody,

I have a graph that contains all the word of a text. This graph is a a directed acyclic graph.

I want to reconstruct sequences of this text so I need to get all the nodes and edges that are dependent of a root node or their children. In other words I want a Sub-tree of a tree.

I cant get it with a recursive ad-hoc function, using out_neighbours(), but I am wondering if there is another more efficient way to obtain it. I searched in the doc but i don't find it.

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Get all the dependant nodes or a root node in a new sub-graph

Tiago Peixoto
Administrator
On 07/04/2012 01:59 PM, josubg wrote:

> Hi everybody,
>
> I have a graph that contains all the word of a text. This graph is a a
> directed acyclic graph.
>
> I want to reconstruct sequences of this text so I need to get all the nodes
> and edges that are dependent of a root node or their children. In other
> words I want a Sub-tree of a tree.
>
> I cant get it with a recursive ad-hoc function, using out_neighbours(), but
> I am wondering if there is another more efficient way to obtain it. I
> searched in the doc but i don't find it.
You want the label_out_component() function:

    http://projects.skewed.de/graph-tool/doc/topology.html#graph_tool.topology.label_out_component

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>




_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (566 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: Get all the dependant nodes or a root node in a new sub-graph

josubg
Thanks!



On Wed, Jul 4, 2012 at 2:09 PM, Tiago de Paula Peixoto <[hidden email]> wrote:
On 07/04/2012 01:59 PM, josubg wrote:
> Hi everybody,
>
> I have a graph that contains all the word of a text. This graph is a a
> directed acyclic graph.
>
> I want to reconstruct sequences of this text so I need to get all the nodes
> and edges that are dependent of a root node or their children. In other
> words I want a Sub-tree of a tree.
>
> I cant get it with a recursive ad-hoc function, using out_neighbours(), but
> I am wondering if there is another more efficient way to obtain it. I
> searched in the doc but i don't find it.

You want the label_out_component() function:

    http://projects.skewed.de/graph-tool/doc/topology.html#graph_tool.topology.label_out_component

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>




_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool



_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool