Learn R Programming

grip (version 0.3.0)

estimate.preparation: Estimate preparation storage before allocating graph distances

Description

Reports a lower bound for dense distance storage, not peak memory or runtime. This arithmetic-only helper does not construct a graph or allocate its cache.

Usage

estimate.preparation(
  n,
  n.edges = NA_integer_,
  pair.mode = c("all_pairs", "landmark_sparse", "distance_matrix_only", "edge_only"),
  local.nbrs = 20L,
  landmark.count = 8L
)

Value

A one-row data frame containing graph counts, pair mode, a pair-count upper bound, and the dense-distance storage lower bound in bytes and GiB.

Arguments

n

Number of vertices.

n.edges

Number of undirected edges, or NA if unknown.

pair.mode

Preparation mode: full paths, landmark paths, distances only, or edges only.

local.nbrs, landmark.count

Counts used by landmark preparation.

Details

One dense double matrix needs 8 * n^2 bytes. Full and landmark preparations currently compute dense distances; landmark mode reduces retained pairs, not that matrix. Trees, routes, copies, R object overhead, and solver workspace require additional memory and are not estimated. Edge-only preparation has no dense distance matrix, but still stores the graph. Use prepare.edge.kk() when only edge constraints are needed, or ordinary grip() when a full geodesic cache is unnecessary.

Dense preparation warns before its searches/allocations when this bound exceeds getOption("grip.preparation.warn.bytes", 512 * 1024^2). Set that option to another positive byte count, or Inf to acknowledge and disable the advisory warning. It is not a hard memory limit. Small calls are quiet. Native refinement checks for cancellation between rounds or optimizer evaluations; worker threads finish an evaluation before interruption is raised on the main thread. Cancellation does not return a partial fit.

See Also

prepare.graph.geodesic.mds(), prepare.landmark.geodesic.kk()

Examples

Run this code
estimate.preparation(10000, n.edges = 20000)
estimate.preparation(10000, n.edges = 20000, pair.mode = "edge_only")

Run the code above in your browser using DataLab