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 selfloops.

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 
isK33Subdivision(Graph<V,E> graph)
Checks whether the
graph is a $K_{3,3}$ subdivision. 
static <V,E> boolean 
isK5Subdivision(Graph<V,E> graph)
Checks whether the
graph is a $K_5$ subdivision. 
static <V,E> boolean 
isKuratowskiSubdivision(Graph<V,E> graph)
Checks whether the
graph is a
Kuratowski subdivision. 
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 
isPlanar(Graph<V,E> graph)
Checks that the specified graph is planar.

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 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 
isTriangleFree(Graph<V,E> graph)
Tests whether an undirected graph is trianglefree (i.e.

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. 
static <V,E> Graph<V,E> 
requireWeighted(Graph<V,E> graph)
Checks that the specified graph is weighted 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 graphConnectivityInspector
public 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 graphBiconnectivityInspector
public 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 graphConnectivityInspector
public 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.
In case of undirected graphs this method delegated to isConnected(Graph)
.
V
 the graph vertex typeE
 the graph edge typegraph
 the input graphKosarajuStrongConnectivityInspector
public 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 graphBipartitePartitioning.isBipartite()
public 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 partitionBipartitePartitioning.isValidPartitioning(PartitioningAlgorithm.Partitioning)
public 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 graphPalmerHamiltonianCycle
public static <V,E> boolean isTriangleFree(Graph<V,E> graph)
GraphMetrics.getNumberOfTriangles(Graph)
.V
 the graph vertex typeE
 the graph edge typegraph
 the input graphpublic static <V,E> boolean isPerfect(Graph<V,E> graph)
BergeGraphInspector
V
 the graph vertex typeE
 the graph edge typegraph
 the graph reference to check for being perfect or notpublic static <V,E> boolean isPlanar(Graph<V,E> graph)
BoyerMyrvoldPlanarityInspector
. Also,
use this class to get a planar embedding of the graph in case it is planar, or a Kuratowski
subgraph as a certificate of nonplanarity.V
 the graph vertex typeE
 the graph edge typegraph
 the graph to test planarity ofPlanarityTestingAlgorithm
,
BoyerMyrvoldPlanarityInspector
public static <V,E> boolean isKuratowskiSubdivision(Graph<V,E> graph)
graph
is a
Kuratowski subdivision.
Effectively checks whether the graph
is a $K_{3,3}$ subdivision or $K_{5}$ subdivisionV
 the graph vertex typeE
 the graph edge typegraph
 the graph to testgraph
is a Kuratowski subdivision, false otherwisepublic static <V,E> boolean isK33Subdivision(Graph<V,E> graph)
graph
is a $K_{3,3}$ subdivision.V
 the graph vertex typeE
 the graph edge typegraph
 the graph to testgraph
is a $K_{3,3}$ subdivision, false otherwisepublic static <V,E> boolean isK5Subdivision(Graph<V,E> graph)
graph
is a $K_5$ subdivision.V
 the graph vertex typeE
 the graph edge typegraph
 the graph to testgraph
is a $K_5$ subdivision, false otherwisepublic 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 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 null
NullPointerException
 if graph
is null
IllegalArgumentException
 if graph
is mixedpublic static <V,E> Graph<V,E> requireWeighted(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 weighted and not nullgraph
if directed and not null
NullPointerException
 if graph
is null
IllegalArgumentException
 if graph
is not weightedCopyright © 2019. All rights reserved.