Skip to contents

Prune Long Edges in a Weighted Graph

Usage

wgraph.prune.long.edges(
  adj.list,
  length.list,
  alt.path.len.ratio.thld,
  use.total.length.constraint = TRUE,
  verbose = FALSE
)

Arguments

adj.list

A graph adjacency list.

length.list

Edge-length list matching adj.list.

alt.path.len.ratio.thld

Alternative-path threshold.

use.total.length.constraint

If TRUE, compare total alternative path length with the original edge. Otherwise require every edge on the alternative path to be shorter than the original edge times the threshold.

verbose

Logical progress flag.

Value

A dgraph object. Use graph.adjacency(), graph.lengths(), graph.edges() and graph.stages() to inspect its stored graph stages. Construction and diagnostic information is stored in metadata.

Examples

graph <- list(c(2L, 3L), c(1L, 3L), c(1L, 2L))
lengths <- list(c(1, 2), c(1, 1), c(2, 1))
graph.adjacency(wgraph.prune.long.edges(graph, lengths, alt.path.len.ratio.thld = 1.1))
#> [[1]]
#> [1] 2 3
#> 
#> [[2]]
#> [1] 1 3
#> 
#> [[3]]
#> [1] 1 2
#>