Skip to content
James Bremner edited this page May 4, 2023 · 10 revisions

This option finds the cycles in a graph. For undirected graphs, 'cycles' that involve shuttling back and forth along a single edge are ignored.

Input

format

The first line specifies the calculation required. It must contain

format cycle

Links

Column Description
1 l for link
2 src node name
3 dst node name

Example

format cycle
l a b
l b c
l c d
l d a

image

Algorithm

The algorithm is a modified depth first search. When a previously visited vertex is reached, the Dijsktra algorithm is applied to find the path that forms the shortest cycle that leads back to the back edge to the previously visited vertex.

Clone this wiki locally