|
From: | Ragia Ibrahim |
Subject: | [igraph] df traversal |
Date: | Sat, 22 Feb 2014 00:03:38 +0200 |
hi, trying to traverse the graph, kindly whats wrong in this..why its infinite loop.. graph_dfs<-function(i) #i is id { if(V(graph)$reached[i] == FALSE) { # print(str(i)); print("is reachable") str(i); print("is reachable") V(graph)$reached[i]<-TRUE node_neighbours<- c(neighbors(graph, i , mode = 2) )#out direction all=1 2=out 3=in 4 = total for( j in 1:length(node_neighbours) ) graph_dfs(node_neighbours[j]) }#end if } thanks in advance } |
[Prev in Thread] | Current Thread | [Next in Thread] |