public abstract class GraphTests extends Object
| Constructor and Description |
|---|
GraphTests() |
| Modifier and Type | Method and Description |
|---|---|
static <V,E> boolean |
hasMultipleEdges(Graph<V,E> graph)
Check if a graph has multiple edges (parallel edges), that is, whether the graph contains two
or more edges connecting the same pair of vertices.
|
static <V,E> boolean |
hasOreProperty(Graph<V,E> graph)
Tests whether an undirected graph meets Ore's condition to be Hamiltonian.
|
static <V,E> boolean |
hasSelfLoops(Graph<V,E> graph)
Check if a graph has self-loops.
|
static <V,E> boolean |
isBiconnected(Graph<V,E> graph)
Tests if the inspected graph is biconnected.
|
static <V,E> boolean |
isBipartite(Graph<V,E> graph)
Test whether a graph is bipartite.
|
static <V,E> boolean |
isBipartitePartition(Graph<V,E> graph,
Set<? extends V> firstPartition,
Set<? extends V> secondPartition)
Test whether a partition of the vertices into two sets is a bipartite partition.
|
static <V,E> boolean |
isChordal(Graph<V,E> graph)
Checks whether a graph is chordal.
|
static <V,E> boolean |
isComplete(Graph<V,E> graph)
Test whether a graph is complete.
|
static <V,E> boolean |
isConnected(Graph<V,E> graph)
Test if the inspected graph is connected.
|
static <V,E> boolean |
isCubic(Graph<V,E> graph)
Tests whether a graph is cubic.
|
static <V,E> boolean |
isEmpty(Graph<V,E> graph)
Test whether a graph is empty.
|
static <V,E> boolean |
isEulerian(Graph<V,E> graph)
Test whether a graph is Eulerian.
|
static <V,E> boolean |
isForest(Graph<V,E> graph)
Test whether an undirected graph is a forest.
|
static <V,E> boolean |
isOverfull(Graph<V,E> graph)
Test whether a graph is overfull.
|
static <V,E> boolean |
isPerfect(Graph<V,E> graph)
Checks that the specified graph is perfect.
|
static <V,E> boolean |
isSimple(Graph<V,E> graph)
Check if a graph is simple.
|
static <V,E> boolean |
isSplit(Graph<V,E> graph)
Test whether an undirected graph is a
split graph.
|
static <V,E> boolean |
isStronglyConnected(Graph<V,E> graph)
Test whether a directed graph is strongly connected.
|
static <V,E> boolean |
isTree(Graph<V,E> graph)
Test whether an undirected graph is a tree.
|
static <V,E> boolean |
isWeaklyChordal(Graph<V,E> graph)
Checks whether a graph is weakly
chordal.
|
static <V,E> boolean |
isWeaklyConnected(Graph<V,E> graph)
Test whether a directed graph is weakly connected.
|
static <V,E> Graph<V,E> |
requireDirected(Graph<V,E> graph)
Checks that the specified graph is directed and throws an
IllegalArgumentException if
it is not. |
static <V,E> Graph<V,E> |
requireDirected(Graph<V,E> graph,
String message)
Checks that the specified graph is directed and throws a customized
IllegalArgumentException if it is not. |
static <V,E> Graph<V,E> |
requireDirectedOrUndirected(Graph<V,E> graph)
Checks that the specified graph is directed and throws an
IllegalArgumentException if
it is not. |
static <V,E> Graph<V,E> |
requireDirectedOrUndirected(Graph<V,E> graph,
String message)
Checks that the specified graph is directed or undirected and throws a customized
IllegalArgumentException if it is not. |
static <V,E> Graph<V,E> |
requireUndirected(Graph<V,E> graph)
Checks that the specified graph is undirected and throws an
IllegalArgumentException
if it is not. |
static <V,E> Graph<V,E> |
requireUndirected(Graph<V,E> graph,
String message)
Checks that the specified graph is undirected and throws a customized
IllegalArgumentException if it is not. |
public static <V,E> boolean isEmpty(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isSimple(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - a graphpublic static <V,E> boolean hasSelfLoops(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - a graphpublic static <V,E> boolean hasMultipleEdges(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - a graphpublic static <V,E> boolean isComplete(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isConnected(Graph<V,E> graph)
This method does not performing any caching, instead recomputes everything from scratch. In
case more control is required use ConnectivityInspector directly.
V - the graph vertex typeE - the graph edge typegraph - the input graphConnectivityInspectorpublic static <V,E> boolean isBiconnected(Graph<V,E> graph)
This method does not performing any caching, instead recomputes everything from scratch. In
case more control is required use
BiconnectivityInspector directly.
V - the graph vertex typeE - the graph edge typegraph - the input graphBiconnectivityInspectorpublic static <V,E> boolean isWeaklyConnected(Graph<V,E> graph)
This method does not performing any caching, instead recomputes everything from scratch. In
case more control is required use ConnectivityInspector directly.
V - the graph vertex typeE - the graph edge typegraph - the input graphConnectivityInspectorpublic static <V,E> boolean isStronglyConnected(Graph<V,E> graph)
This method does not performing any caching, instead recomputes everything from scratch. In
case more control is required use KosarajuStrongConnectivityInspector directly.
V - the graph vertex typeE - the graph edge typegraph - the input graphKosarajuStrongConnectivityInspectorpublic static <V,E> boolean isTree(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isForest(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isOverfull(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isSplit(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isBipartite(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isBipartitePartition(Graph<V,E> graph, Set<? extends V> firstPartition, Set<? extends V> secondPartition)
V - the graph vertex typeE - the graph edge typegraph - the input graphfirstPartition - the first vertices partitionsecondPartition - the second vertices partitionpublic static <V,E> boolean isCubic(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphpublic static <V,E> boolean isEulerian(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphHierholzerEulerianCycle.isEulerian(Graph)public static <V,E> boolean isChordal(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphChordalityInspector.isChordal()public static <V,E> boolean isWeaklyChordal(Graph<V,E> graph)
The following definitions are equivalent:
V - the graph vertex typeE - the graph edge typegraph - the input graphWeakChordalityInspector.isWeaklyChordal()public static <V,E> boolean hasOreProperty(Graph<V,E> graph)
V - the graph vertex typeE - the graph edge typegraph - the input graphPalmerHamiltonianCyclepublic static <V,E> Graph<V,E> requireDirected(Graph<V,E> graph, String message)
IllegalArgumentException if it is not. Also checks that the graph reference is not
null and throws a NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for beeing directed and not nullmessage - detail message to be used in the event that an exception is throwngraph if directed and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is not directedpublic static <V,E> Graph<V,E> requireDirected(Graph<V,E> graph)
IllegalArgumentException if
it is not. Also checks that the graph reference is not null and throws a
NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for beeing directed and not nullgraph if directed and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is not directedpublic static <V,E> Graph<V,E> requireUndirected(Graph<V,E> graph, String message)
IllegalArgumentException if it is not. Also checks that the graph reference is not
null and throws a NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for being undirected and not nullmessage - detail message to be used in the event that an exception is throwngraph if undirected and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is not undirectedpublic static <V,E> Graph<V,E> requireUndirected(Graph<V,E> graph)
IllegalArgumentException
if it is not. Also checks that the graph reference is not null and throws a
NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for being undirected and not nullgraph if undirected and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is not undirectedpublic static <V,E> Graph<V,E> requireDirectedOrUndirected(Graph<V,E> graph, String message)
IllegalArgumentException if it is not. Also checks that the graph reference is not
null and throws a NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for beeing directed or undirected and not nullmessage - detail message to be used in the event that an exception is throwngraph if directed and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is mixedpublic static <V,E> Graph<V,E> requireDirectedOrUndirected(Graph<V,E> graph)
IllegalArgumentException if
it is not. Also checks that the graph reference is not null and throws a
NullPointerException if it is.V - the graph vertex typeE - the graph edge typegraph - the graph reference to check for beeing directed and not nullgraph if directed and not nullNullPointerException - if graph is nullIllegalArgumentException - if graph is mixedpublic static <V,E> boolean isPerfect(Graph<V,E> graph)
BergeGraphInspectorV - the graph vertex typeE - the graph edge typegraph - the graph reference to check for being perfect or notboolean if graph is perfectCopyright © 2018. All rights reserved.