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 <[email protected]> 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
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to