Package com.jgalgo.alg.cycle
Interface CyclesEnumerator
- All Known Implementing Classes:
CyclesEnumeratorAbstract
,CyclesEnumeratorJohnson
,CyclesEnumeratorTarjan
public interface CyclesEnumerator
An algorithm that enumerate all cycles in a graph.
Given a graph \(G = (V, E)\), a cycle is a path \(P = (v_1, v_2, \ldots, v_k), v_i \in V, (v_i,v_{i+1}) \in E\) such
that \(v_1 = v_k\). There might be exponentially many cycles in a graph, and algorithms implementing this interface
enumerate over all of them (use an Iterator
avoiding storing all of them in memory).
Use newInstance()
to get a default implementation of this interface.
- Author:
- Barak Ugav
-
Method Summary
Modifier and TypeMethodDescriptioncyclesIter
(Graph<V, E> g) Iterate over all cycles in the given graph.static CyclesEnumerator
Create a new algorithm for cycles enumerating.
-
Method Details
-
cyclesIter
Iterate over all cycles in the given graph.If
g
isIntGraph
, the returned iterator will iterate overIPath
objects.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graph- Returns:
- an iterator that iteration over all cycles in the graph
-
newInstance
Create a new algorithm for cycles enumerating.This is the recommended way to instantiate a new
CyclesEnumerator
object.- Returns:
- a default implementation of
CyclesEnumerator
-