java.lang.Object
org.jgrapht.alg.clique.BaseBronKerboschCliqueFinder<V,E>
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
Iterable<Set<V>>,MaximalCliqueEnumerationAlgorithm<V,E>
- Direct Known Subclasses:
BronKerboschCliqueFinder,PivotBronKerboschCliqueFinder
abstract class BaseBronKerboschCliqueFinder<V,E>
extends Object
implements MaximalCliqueEnumerationAlgorithm<V,E>
Base implementation of the Bron-Kerbosch algorithm.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe resultThe underlying graphprotected intSize of biggest maximal clique found.protected final longTimeout in nanosecondsprotected booleanWhether the last computation terminated due to a time limit. -
Constructor Summary
ConstructorsConstructorDescriptionBaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck the computation has stopped due to a time limit or due to computing all maximal cliques.iterator()Returns an iterator over all maximal cliques.protected abstract voidlazyRun()Lazily start the computation.Create an iterator which returns only the maximum cliques of a graph.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
graph
The underlying graph -
nanos
protected final long nanosTimeout in nanoseconds -
timeLimitReached
protected boolean timeLimitReachedWhether the last computation terminated due to a time limit. -
allMaximalCliques
The result -
maxSize
protected int maxSizeSize of biggest maximal clique found.
-
-
Constructor Details
-
BaseBronKerboschCliqueFinder
Constructor- Parameters:
graph- the input graph; must be simpletimeout- the maximum time to wait, if zero no timeoutunit- the time unit of the timeout argument
-
-
Method Details
-
iterator
Description copied from interface:MaximalCliqueEnumerationAlgorithmReturns an iterator over all maximal cliques. -
maximumIterator
Create an iterator which returns only the maximum cliques of a graph. The iterator computes all maximal cliques and then filters them by the size of the maximum found clique.- Returns:
- an iterator which returns only the maximum cliques of a graph
-
isTimeLimitReached
public boolean isTimeLimitReached()Check the computation has stopped due to a time limit or due to computing all maximal cliques.- Returns:
- true if the computation has stopped due to a time limit, false otherwise
-
lazyRun
protected abstract void lazyRun()Lazily start the computation.
-