java.lang.Object
org.jgrapht.alg.partition.BipartitePartitioning<V,E>
- Type Parameters:
- V- the graph vertex type
- E- the graph edge type
- All Implemented Interfaces:
- PartitioningAlgorithm<V>
public class BipartitePartitioning<V,E> extends java.lang.Object implements PartitioningAlgorithm<V>
Algorithm for computing bipartite partitions thus checking whether a graph is bipartite or not.
 
The algorithm runs in linear time in the number of vertices and edges.
- Author:
- Dimitrios Michail, Alexandru Valeanu
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.jgrapht.alg.interfaces.PartitioningAlgorithmPartitioningAlgorithm.Partitioning<V>, PartitioningAlgorithm.PartitioningImpl<V>
- 
Constructor SummaryConstructors Constructor Description BipartitePartitioning(Graph<V,E> graph)Constructs a new bipartite partitioning.
- 
Method SummaryModifier and Type Method Description PartitioningAlgorithm.Partitioning<V>getPartitioning()Computes a vertex partitioning.booleanisBipartite()Test whether the input graph is bipartite.booleanisValidPartitioning(PartitioningAlgorithm.Partitioning<V> partitioning)Check if the given vertex partitioning is valid.
- 
Constructor Details- 
BipartitePartitioningConstructs a new bipartite partitioning.- Parameters:
- graph- the input graph;
 
 
- 
- 
Method Details- 
isBipartitepublic boolean isBipartite()Test whether the input graph is bipartite.- Returns:
- true if the input graph is bipartite, false otherwise
 
- 
getPartitioningComputes a vertex partitioning.- Specified by:
- getPartitioningin interface- PartitioningAlgorithm<V>
- Returns:
- a vertex partitioning
 
- 
isValidPartitioningCheck if the given vertex partitioning is valid.- Specified by:
- isValidPartitioningin interface- PartitioningAlgorithm<V>
- Parameters:
- partitioning- the input vertex partitioning
- Returns:
- true if the input partitioning is valid, false otherwise
 
 
-