create.geodesic.iknn.graph: Create a graph-geodesic iKNN graph

View source: R/geodesic_iknn_graphs.R

create.geodesic.iknn.graphR Documentation

Create a graph-geodesic iKNN graph

Description

Rebuilds an iKNN graph from an existing weighted graph by using graph geodesic distances in place of Euclidean distances. For every vertex i, the graph-metric neighbor set contains the first k finite graph-geodesic nearest vertices under the same convention used by create.iknn.graphs(). Because self-distance is zero, this includes i whenever i is finite from itself. Vertices i and j are connected in the returned graph when those two neighbor sets intersect.

Usage

create.geodesic.iknn.graph(graph, k)

Arguments

graph

A weighted graph list with entries adj_list and weight_list, as returned by create.iknn.graphs(..., compute.full = TRUE) in geom_pruned_graphs.

k

Integer number of graph-metric nearest vertices in each neighbor set, matching the k convention used by create.iknn.graphs().

Value

A list with entries:

adj_list

1-based adjacency list for the final graph.

weight_list

Final graph-geodesic edge lengths from the input graph.

raw_adj_list, raw_weight_list

The native geodesic iKNN graph.

pruned_adj_list, pruned_weight_list

Identical to raw_* because geodesic iKNN graphs do not currently have a pruning stage.

raw_repaired_adj_list, raw_repaired_weight_list, pruned_repaired_adj_list, pruned_repaired_weight_list, repaired_pruned_adj_list, repaired_pruned_weight_list

Lifecycle aliases identical to the final graph because this constructor has no MST repair or pruning stage.

isize_list

Intersection sizes for each edge.

n_edges

Number of undirected edges.

Examples

graph <- list(
  adj_list = list(2L, c(1L, 3L), 2L),
  weight_list = list(1, c(1, 1), 1)
)
create.geodesic.iknn.graph(graph, k = 1)


dgraphs documentation built on Aug. 21, 2026, 1:08 a.m.