I want to analyse a social network using the R packages statnet and/or igraph in reference to force-directed graph drawing (kamada.kawai/fruchterman.reingold). I wounder, if it is possible to adjust the "force" between 2 specific nodes, e.g. to consider a larger or smaller cooperation between 2 stakeholders. However, i do not want to edit the general force between all nodes

(as proposed here:)

How do I lengthen edges in an igraph network plot (layout=fruchterman.reingold)?

The idea on this would be to get a more realistic image of a social network, also for further analysis.

Thanks a lot and nice weekend to everybody!

有帮助吗?

解决方案

This layout algorithm supports edge weights, which are basically used as multipliers for the attraction forces along the edges. I.e. edges with high weight will tend to be shorter. Here is a simple example

library(igraph)

g <- graph.ring(10)

# Edge weights, will be recycled
E(g)$weight <- c(1,4)
coords <- layout.fruchterman.reingold(g, weights=E(g)$weight)

# Eliminate the margin
par(mar=c(0,0,0,0))
plot(g, layout=coords, vertex.color="#E495A5", vertex.size=20)

plot

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top