~~ Methods for Function eulerian ~~
eulerian.Rd
A generic function that returns an eulerian (or nearly eulerian)
path based on self
.
Value
A vector representing the eulerian- a character vector of node names for a graph, otherwise a numeric vector. If the graph is not connected, the result is a list of eulerians for each connected component.
Methods
- self = "even_graph"
Uses
etour
to construct the eulerian. Ifweighted
is TRUE a weighted eulerian is constructed, otherwise weights are ignored. A non-nullstart
is the eulerian starting point.- self = "graphNEL"
Augments the graph using
mk_euler_graph
, then invokes eulerian again on the augmented verion. If self is not connected, (approximate) eulerians are formed for each connected component, which are returned as a list.- self = "matrix"
Builds a graph using
mk_euler_graph
, then invokes eulerian again on the result.- self = "numeric"
Builds a graph with self nodes using
mk_euler_graph
, then invokes eulerian again on the result.- self = "ANY"
Builds a graph using
mk_euler_graph
, then invokes eulerian again on the result.
References
C. Hierholzer (1873). Uber die Moglichkeit, einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren. Math. Annalen VI, pp. 30-32.
Also, see overview
Examples
require(PairViz)
d <- as.matrix(eurodist)[1:8,1:8] # pick the first 8 cities
eulerian(d)
#> [1] 4 3 6 4 5 3 8 4 7 6 7 3 2 8 5 6 2 5 8 7 5 1 8 6 1 3 2 4 1 7 2 1
eulerian(d, weighted=FALSE) # In this case, starts at city 1 and ends at city 8
#> [1] 1 2 3 1 4 2 5 1 6 2 7 1 8 2 3 4 5 3 6 4 7 3 8 4 5 6 7 5 8 6 7 8