Learn R Programming

grip (version 0.3.0)

prepare.graph.geodesic.mds: Prepare a graph-first geodesic-MDS path cache

Description

prepare.graph.geodesic.mds() prepares the full all-pairs chosen geodesic cache for an arbitrary connected weighted graph. This is the graph-first entry point corresponding to the manuscript's definition of GMDS on a connected weighted graph together with a chosen geodesic family \((G, \Gamma)\).

Usage

prepare.graph.geodesic.mds(
  edges = NULL,
  n = NULL,
  adj.list = NULL,
  weight.list = NULL,
  edge.weights = NULL,
  tie.mode = c("single", "average")
)

Value

A prepared object with class "grip_gmds_prepared" layered on top of the existing full geodesic path-cache structure.

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.

Details

The graph can be supplied either as an edge list plus parallel weights or as an adjacency-list representation. The returned object stores the all-pairs graph distances, the chosen shortest-path family, and the flattened edge-path cache reused by the GMDS scorer and optimizer.

The all-pairs distance.matrix contains symmetric strict graph distances. Retained-route lengths in pair_graph_distance follow the deterministic near-tie path convention and can differ slightly from these targets. Route selection and path diagnostics are not changed by this distinction.

Examples

Run this code
cycle_edges <- edges.cycle(6)
prepared <- prepare.graph.geodesic.mds(cycle_edges, n = 6)

Run the code above in your browser using DataLab