Skip to contents

prepare.geodesic.kk() builds the deterministic all-pairs shortest path cache needed to evaluate or optimize the full geodesic Kamada–Kawai objective repeatedly on the same connected graph.

Usage

prepare.geodesic.kk(
  edges = NULL,
  n = NULL,
  adj_list = NULL,
  weight_list = NULL,
  edge_weights = NULL,
  tie_mode = c("single", "average")
)

Arguments

edges

Two-column integer matrix of edges (1-based vertex ids).

n

Number of vertices. If omitted with adj_list, defaults to length(adj_list). If omitted with edges, defaults to max(edges).

adj_list

Adjacency list (1-based) for an undirected graph.

weight_list

Optional parallel list of positive edge weights.

edge_weights

Optional positive edge-weight vector parallel to edges.

tie_mode

Shortest-path aggregation mode. "single" uses one deterministic chosen shortest path per pair. "average" replaces each tied shortest-path family by the exact uniform average over all shortest paths between the pair.

Value

A list with the all-pairs graph distances, chosen paths, and cached path-edge realizations. The object has class "grip_gkk_prepared".

Details

For each unordered vertex pair, the prepared object stores either one deterministic chosen graph shortest path (tie_mode = "single") or the exact uniform average over all tied shortest paths (tie_mode = "average"), together with the graph distance and the corresponding cached edge realization. This is the full all-pairs analogue of the sparse landmark cache used by prepare.landmark.geodesic.kk().