If a graph object is a not directed graph, then the following set of operations should yield the same result:


df <- read.csv("Dataset1-Media-Example-EDGES.csv")

g3 <- graph.data.frame(df[,1:2], directed = F)
g4 <- graph.data.frame(df[,2:1], directed = F)

g3_ <- cluster_walktrap(g3)
g4_ <- cluster_walktrap(g4)


But it doesn't. I would like to understand why. Since the graph is not directed, I don't understand why switching the edges definition in g3 and g4 changes the graph (g3 is different from g4) and, consequently, the result of calling the walktrap algorithm.

The data for reproducing the example can be found on this blog article at this link.

Feel free to either answer on my example or use another example.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.