best_orientation: Re-orients a path to be weight-decreasing

View source: R/hamorder.R

best_orientationR Documentation

Re-orients a path to be weight-decreasing

Description

Re-orients a path/cycle, preserving adjacencies so that weights tend to decrease. From specifies the starting point, for cycles only.

Usage

best_orientation(path, d, cycle=FALSE, path_dir= path_cor, from=NULL)

Arguments

path

A vector giving a hamiltonian.

d

A dist, used to provide edge weights.

cycle

If TRUE, the path is interpreted as a closed path.

path_dir

A function used to evaluate a path start and orientation

from

Sepcifies the starting point, for cycles only.

Author(s)

C.B. Hurley and R.W. Oldford

References

see overview

See Also

hpaths, eulerian.

Examples


require(PairViz)

rdist <- function(n) {
	d <- matrix(0,n,n)
	d[lower.tri(d)] <- runif(n*(n-1)/2)
	return(as.dist(d))
	}
r <- rdist(7)
best_orientation(1:7,r) 
best_orientation(1:7,r,cycle=TRUE) 


PairViz documentation built on Aug. 12, 2022, 5:06 p.m.