V - the graph vertex typeE - the graph edge typepublic class BronKerboschCliqueFinder<V,E>
extends java.lang.Object
Implementation of the Bron-Kerbosch clique enumeration algorithm as described in:
The algorithm first computes all maximal cliques and then returns the result to the user. A timeout can be set using the constructor parameters.
PivotBronKerboschCliqueFinder,
DegeneracyBronKerboschCliqueFinder| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.util.Set<V>> |
allMaximalCliques
The result
|
protected Graph<V,E> |
graph
The underlying graph
|
protected int |
maxSize
Size of biggest maximal clique found.
|
protected long |
nanos
Timeout in nanoseconds
|
protected boolean |
timeLimitReached
Whether the last computation terminated due to a time limit.
|
| Constructor and Description |
|---|
BronKerboschCliqueFinder(Graph<V,E> graph)
Constructs a new clique finder.
|
BronKerboschCliqueFinder(Graph<V,E> graph,
long timeout,
java.util.concurrent.TimeUnit unit)
Constructs a new clique finder.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isTimeLimitReached()
Check the computation has stopped due to a time limit or due to computing all maximal
cliques.
|
java.util.Iterator<java.util.Set<V>> |
iterator()
Returns an iterator over all maximal cliques.
|
protected void |
lazyRun()
Lazily execute the enumeration algorithm.
|
java.util.Iterator<java.util.Set<V>> |
maximumIterator()
Create an iterator which returns only the maximum cliques of a graph.
|
protected final Graph<V,E> graph
protected final long nanos
protected boolean timeLimitReached
protected java.util.List<java.util.Set<V>> allMaximalCliques
protected int maxSize
public BronKerboschCliqueFinder(Graph<V,E> graph)
graph - the input graph; must be simplepublic BronKerboschCliqueFinder(Graph<V,E> graph, long timeout, java.util.concurrent.TimeUnit unit)
graph - the input graph; must be simpletimeout - the maximum time to wait, if zero no timeoutunit - the time unit of the timeout argumentprotected void lazyRun()
public java.util.Iterator<java.util.Set<V>> iterator()
MaximalCliqueEnumerationAlgorithmiterator in interface java.lang.Iterable<java.util.Set<V>>iterator in interface MaximalCliqueEnumerationAlgorithm<V,E>public java.util.Iterator<java.util.Set<V>> maximumIterator()
public boolean isTimeLimitReached()
Copyright © 2019. All Rights Reserved.