Learn R Programming

gor (version 2.0)

find_euler: Constructing an Eulerian Cycle

Description

It finds an Eulerian cycle using a \(O(q)\) algorithm where \(q\) is the number of edges of the graph.

Usage

find_euler(G, v)

Value

A two-element list: the $walk component is a \(q\times2\) matrix edgelist, and the $graph component is the input graph with no edges; it is used in intermediate steps, when the function calls itself.

Arguments

G

Eulerian and connected graph

v

Any vertex as starting point of the cycle

Disclaimer

This function is part of the subject "Graphs and Network Optimization". It is designed for teaching purposes only, and not for production.

  • It is introduced in the "Connectivity" section.

  • It is used as a subroutine in the "TSP" section.

Author

Cesar Asensio (2021)

Details

Recursive algorithm for undirected graphs. The input graph should be Eulerian and connected.

References

Korte, Vygen: Combinatorial Optimization (Springer) sec 2.4.

See Also

build_tour_2tree double-tree algorithm.

Examples

Run this code
library(igraph)
find_euler(make_full_graph(5), 1)$walk   # Walk of length 10

Run the code above in your browser using DataLab