powered by
Compute node positions using the Fruchterman-Reingold force-directed algorithm. Nodes connected by edges are attracted to each other while all nodes repel each other.
layout_spring( network, iterations = 500, cooling = 0.95, repulsion = 1, attraction = 1, seed = NULL, initial = NULL )
Data frame with x, y coordinates.
A CographNetwork object.
Number of iterations (default: 500).
Rate of temperature decrease (default: 0.95).
Repulsion constant (default: 1).
Attraction constant (default: 1).
Random seed for reproducibility.
Optional initial coordinates (matrix or data frame).
adj <- matrix(c(0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0), nrow = 4) net <- CographNetwork$new(adj) coords <- layout_spring(net, seed = 42)
Run the code above in your browser using DataLab