|
From: | Ross KK Leung |
Subject: | Re: [igraph] getting k-connected nodes from a vertex |
Date: | Thu, 6 Dec 2012 14:49:43 +0800 |
Thank you, Gabot. Exactly. g <- read.graph("two-col-edgelist-100000rows.txt",format="ncol",names=TRUE) g2 <- graph.neighborhood(g,1,"A_vertex_name") and all the above commands finish elegantly. HOWEVER, IT IS A LIST OF GRAPHS AND THE NAMES OF THE VERTICES MAY HAVE LOST? I am planning to use neighborhood to create a set of new graphs and write them out by the function write.graph(g, "edgelist.txt",format="edgelist") so I will obtain some resultant files like: Example_file_1: V_NAME_ABC V_NAME_HHH V_NAME_ABC V_NAME_HHK V_NAME_ABC V_NAME_ANOTHER V_NAME_ABC V_NAME_SAVE V_NAME_ABC V_NAME_EXAMP V_NAME_ABC V_NAME_TEST From: address@hidden [mailto:address@hidden On Behalf Of Gábor Csárdi Look at the function graph.neighborhood(), I think that does exactly what you want. Gabot On Tue, Dec 4, 2012 at 8:47 AM, Ross KK Leung <address@hidden> wrote: Has igraph any function to retrieve the nodes connected to a specified vertex recursively? For example, a root is connected to 3 leaves, and then these 3 leaves are each connected to 2, 1, 4 leaves respectively, and then that 2, 1, 4 leaves are used again to search. So this should be something like depth-first search but I’m unable to identify how to get back the edgelist for this search and the layer (or depth) that I can specify to search.
-- |
[Prev in Thread] | Current Thread | [Next in Thread] |