Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a graph with few hundred nodes and edges. The disconnected subgraphs separate out and resolve well but the nodes within subgraphs overlap and do not resolve well. I have tried several layout algorithms and have also tried changing the relevant parameters within the layout algorithm (ex: iter, kkconst, start.temp etc). But, I am still not able to disperse the tightly clustered nodes. See figure below.

I was hoping to find some parameter to control attraction/repulsion/gravity etc but there seems to be none. The answer and figures from bdemarest in this question does seem to fix exactly this issue. Strangely enough, several seemingly useful parameters have been deprecated in the new version of igraph (coolexp, maxdelta, area, repulserad etc).

Does anyone know of a way to keep the sub graphs well separated while spreading out close nodes well enough that they do not overlap?

graphs

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

I managed to get it to work using package qgraph.

enter image description here

Here is a working example:

library(igraph)
library(qgraph)

g <- barabasi.game(355, directed=FALSE)

png("plot1.png", height=6, width=12, units="in", res=250)
par(mfrow=c(1, 3))

plot(g,layout=layout_with_fr,vertex.size=4,vertex.label=NA)
mtext("layout_with_fr", side=1)

e <- get.edgelist(g)
l <- qgraph.layout.fruchtermanreingold(e,vcount=vcount(g))
plot(g,layout=l,vertex.size=4,vertex.label=NA)
mtext("qgraph.layout.fruchtermanreingold default", side=1)

l <- qgraph.layout.fruchtermanreingold(e,vcount=vcount(g),
      area=8*(vcount(g)^2),repulse.rad=(vcount(g)^3.1))
plot(g,layout=l,vertex.size=4,vertex.label=NA)
mtext("qgraph.layout.fruchtermanreingold modified", side=1)

dev.off()

fig2


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...