Package org.jgrapht.alg.cycle
Class PatonCycleBase<V,E>
- java.lang.Object
-
- org.jgrapht.alg.cycle.PatonCycleBase<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
CycleBasisAlgorithm<V,E>
public class PatonCycleBase<V,E> extends Object implements CycleBasisAlgorithm<V,E>
Find a cycle basis of an undirected graph using a variant of Paton's algorithm.See:
K. Paton, An algorithm for finding a fundamental set of cycles for an undirected linear graph, Comm. ACM 12 (1969), pp. 514-518.Note that Paton's algorithm produces a fundamental cycle basis while this implementation produces a weakly fundamental cycle basis. A cycle basis is called weakly fundamental if there exists a linear ordering of the cycles in a cycle basis such that each cycle includes at least one edge that is not part of any previous cycle. Every fundamental cycle basis is weakly fundamental (for all linear orderings) but not necessarily vice versa.
- Author:
- Nikolay Ognyanov
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jgrapht.alg.interfaces.CycleBasisAlgorithm
CycleBasisAlgorithm.CycleBasis<V,E>, CycleBasisAlgorithm.CycleBasisImpl<V,E>
-
-
Constructor Summary
Constructors Constructor Description PatonCycleBase(Graph<V,E> graph)
Create a cycle base finder for the specified graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CycleBasisAlgorithm.CycleBasis<V,E>
getCycleBasis()
Return an undirected cycle basis of a graph.
-
-
-
Constructor Detail
-
PatonCycleBase
public PatonCycleBase(Graph<V,E> graph)
Create a cycle base finder for the specified graph.- Parameters:
graph
- the input graph- Throws:
IllegalArgumentException
- if the graph argument isnull
or the graph is not undirected
-
-
Method Detail
-
getCycleBasis
public CycleBasisAlgorithm.CycleBasis<V,E> getCycleBasis()
Return an undirected cycle basis of a graph. Works only for undirected graphs which do not have multiple (parallel) edges.- Specified by:
getCycleBasis
in interfaceCycleBasisAlgorithm<V,E>
- Returns:
- an undirected cycle basis
- Throws:
IllegalArgumentException
- if the graph is not undirectedIllegalArgumentException
- if the graph contains multiple edges between two vertices
-
-