score.layout() evaluates a realized layout without assuming a
canonical embedding. It is the low-level scoring helper behind
compare.layouts() and is most useful when you already have
one realized layout in hand, for example from a cached run or another graph
drawing tool. For real-world graphs, quality is judged by graph-distance
faithfulness, edge-length consistency, separation of non-neighbors, and
optionally edge crossings or cluster separation.
score.layout(
coords,
edges = NULL,
n = NULL,
adj_list = NULL,
weight_list = NULL,
edge_weights = NULL,
clusters = NULL,
sample.size.stress = 2000L,
sample.size.nonedge = 5000L,
stress.seed = 1L,
nonedge.seed = 1L,
edge.crossings = c("auto", "always", "never"),
edge.crossings.max.edges = 1000L
)A one-row data frame with dot-delimited metric names.
Numeric coordinate matrix with 2 or 3 columns.
Two-column integer matrix of edges (1-based vertex ids).
Number of vertices. If omitted with adj_list, defaults to
length(adj_list). If omitted with edges, defaults to
nrow(coords).
Adjacency list (1-based) for undirected graphs.
Optional parallel list of positive edge weights.
Optional positive edge-weight vector parallel to
edges.
Optional cluster or community labels of length
nrow(coords). When supplied, cluster.separation is reported.
Number of vertex pairs sampled for
sampled.stress.
Number of non-edge pairs sampled for
sampled.nonedge.sep.ratio.
RNG seed used for the stress sample.
RNG seed used for the non-edge sample.
How to compute edge.crossings for 2D layouts:
"auto" computes exact crossings only when the graph is small enough,
"always" always computes them, and "never" skips them.
Edge-count threshold used by
edge.crossings = "auto".
edges <- edges.mesh(5, 5)
coords <- grip(edges, n = 25, dim = 2, preset = "mesh", seed = 1)
score.layout(coords, edges = edges, n = 25)
Run the code above in your browser using DataLab