igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] df traversal


From: Gábor Csárdi
Subject: Re: [igraph] df traversal
Date: Fri, 21 Feb 2014 18:07:00 -0500

See http://cran.r-project.org/doc/manuals/r-release/R-intro.html#Assignment-within-functions

V(graph)$reached[i] <- TRUE

creates a new graph and does not modify the original one.

G.


On Fri, Feb 21, 2014 at 5:03 PM, Ragia Ibrahim <address@hidden> wrote:

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
}

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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