Igraph's edge-betweenness algorithm: Why doesn't "undirected parameter" perform as expected?

时间:2016-04-04 16:46:52

标签: r igraph

I have a weighted and directed adjacency matrix. I'd like to run igraph's fast_greedy community detection algorithm on it, but get the following error code:

Error in .Call("R_igraph_community_fastgreedy", graph, as.logical(merges), : At fast_community.c:538 : fast greedy community detection works for undirected graphs only, Unimplemented function call

My solution is to change the adjacency matrix so that the values in the bottom half of the matrix are rewritten to be in the top half. This should represent the same data as the previous matrix, but is agnostic as to the direction.

Here's my data: https://drive.google.com/open?id=0B8ss18LQyoQrZl83M2F3UUJuSVU

I don't think this works, for the following reason: I ran the two adjacency matrixes on the edge_betweenness cluster algorithm - which allows for a "directed" parameter. I ran the "undirected" parameter with the one-half-only matrix, and the "directed" parameter with the matrix with distributed values.
Here is my code:

cat<-read.csv(file="[insert file name].csv",header=T,sep=",")
cat<-as.matrix(cat)
g <- graph.adjacency(cat, weighted=T, mode = "undirected")
fg<-cluster_edge_betweenness(g,merges=T,modularity=T,membership=T)
g<-simplify(g)

plot(g,vertex.size=10,layout=layout_as_star, vertex.color="black",vertex.label.color='black', vertex.label.family="sans",vertex.frame.color= "black",vertex.label.font=2,vertex.label.dist=1,vertex.label.cex=.95, main="Undirect AdjMat",edge.width=1,edge.color="black",mark.groups=communities(fg))

But they came up with different results. Can anyone tell me why? Many thanks in advance for your time.

0 个答案:

没有答案