public abstract class GraphTests extends Object
Constructor and Description 

GraphTests() 
Modifier and Type  Method and Description 

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 
isComplete(Graph<V,E> graph)
Test whether a graph is complete.

static <V,E> boolean 
isConnected(Graph<V,E> graph)
Test whether an undirected 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 
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 
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 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 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.
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 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> 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 mixedCopyright © 2017. All rights reserved.