etour

0th

Percentile

Constructs eulerian tours on a graph.

etour-- Constructs an eulerian tour on a graph using Hierholzer's algorithm. Returns a vector of node labels. If weighted is TRUE constructs a weight-decreasing eulerian using the modified Hierholzer's algorithm. Usually etour is not called directly, rather the generic function eulerian is used.

Keywords
graphs
Usage
etour(g, start=NULL,weighted=TRUE)
Arguments
g

a graph satisfying is_even_graph

start

an optional starting node for the tour.

weighted

whether tour uses weights

Details

The supplied graph should satisfyis_even_graph. If weighted is TRUE the lowest weight edge is found, and the tour starts at the one of its nodes, picking the node with the bigger second-smallest edge weight. After that the tour follows weight-increasing edges. If weighted is FALSE weights are ignored. The returned tour is typically a closed path. However, if the last edge is a duplicated edge added to make the graph even, this edge is omitted and the result is an open path.

see overview

• etour
Examples
# NOT RUN {
require(PairViz)

g <- mk_even_graph(5)

etour(g)
g <- mk_even_graph(6) # adds 3 extra edges to g, so all nodes are even
etour(g)
etour(g, start= "4") # modifies the starting node

eulerian(6) # The eulerian wrapper looks after making even graph,
#also returns numbers rather than nodes

# On a general graph.
v <- LETTERS[1:4]
g <- new("graphNEL",nodes=v)
etour(g)

eulerian(g) # Equivalently, use eulerian wrapper

n <- LETTERS[1:5]
g <- new("graphNEL",nodes=n)