public final class GraphChecker extends Object
v0, v1, v2, ... , vk
forms a cycle if v0 = vk
and consists of
at least one edge.
n
children.Modifier and Type | Method and Description |
---|---|
static boolean |
isAcyclic(Graph graph)
Checks whether or not the given directed graph is acyclic.
|
static boolean |
isBiconnected(Graph graph)
Checks whether or not the given undirected graph is biconnected.
|
static boolean |
isBipartite(Graph graph)
Checks whether or not the given undirected graph is bipartite.
|
static boolean |
isConnected(Graph graph)
Checks whether or not the given graph is connected.
|
static boolean |
isCyclic(Graph graph)
Checks whether or not the given directed graph is cyclic.
|
static boolean |
isForest(Graph graph)
Checks whether the given graph is a forest.
|
static boolean |
isMultipleEdgeFree(Graph graph)
Checks whether or not the given undirected graph contains no multiple edges.
|
static boolean |
isNaryTree(Graph graph,
int n)
Checks whether or not the given graph is a directed rooted tree where each node has a maximum of
n children. |
static boolean |
isPlanar(Graph graph)
Checks whether or not the given graph is planar.
|
static boolean |
isRootedTree(Graph graph)
Checks whether or not the given directed graph is a directed rooted tree.
|
static boolean |
isSelfLoopFree(Graph graph)
Checks whether or not the given graph contains no self-loops.
|
static boolean |
isSimple(Graph graph)
Checks whether or not the given directed graph is simple.
|
static boolean |
isStronglyConnected(Graph graph)
Checks whether or not the given directed graph is strongly connected.
|
static boolean |
isTree(Graph graph)
Checks whether or not the given graph is an undirected tree.
|
public static final boolean isAcyclic(Graph graph)
A graph is called acyclic if it contains no directed cycle.
isAcyclic(graph) <=> !isCyclic(graph)
.graph
- the given graphtrue
if the graph is acyclic, false
, otherwisepublic static final boolean isBiconnected(Graph graph)
A graph is called biconnected if it has no cut vertex or articulation point, i.e., no node whose removal disconnects the graph.
graph
- the given undirected graphtrue
if the graph is biconnected, false
otherwisepublic static final boolean isBipartite(Graph graph)
A graph is called bipartite if its nodes can be partitioned into two sets such that each edge connects two nodes of different sets.
graph
- the given undirected graphtrue
if the graph is bipartite, false
otherwisepublic static final boolean isConnected(Graph graph)
A graph is called connected if there exists an undirected path of edges between every pair of nodes.
graph
- the given graphtrue
if the graph is connected, false
otherwisepublic static final boolean isCyclic(Graph graph)
A graph is called cyclic if it contains a directed cycle.
isCyclic(graph) <=> !isAcyclic(graph)
.graph
- the given graphtrue
if the graph is cyclic, false
, otherwisepublic static final boolean isForest(Graph graph)
A graph is a forest if its connected components are trees.
graph
- the given graphtrue
if the graph is a forest, false
otherwisepublic static final boolean isMultipleEdgeFree(Graph graph)
More precisely, the method returns true
if the graph contains no two distinct edges e1, e2
that connect
the same pairs of nodes in either direction.
isMultipleEdgeFree(graph) => isSimple(graph)
.graph
- the given undirected graphtrue
if the graph contains no multiple edges, false
otherwisepublic static final boolean isNaryTree(Graph graph, int n)
n
children.graph
- the given graphtrue
if the graph is a directed rooted tree where each node has at most n
children, false
otherwisepublic static final boolean isPlanar(Graph graph)
A graph is called planar if it can be drawn on the plane without edge crossings.
graph
- the given graphtrue
if the graph is planar, false
, otherwise.public static final boolean isRootedTree(Graph graph)
isRootedTree(graph) => isTree(graph)
graph
- the given graphtrue
if the graph is a directed rooted tree, false
otherwisepublic static final boolean isSelfLoopFree(Graph graph)
!isSelfLoopFree(graph) => !isAcyclic(graph)
graph
- the given graphtrue
if the graph contains no self-loops, false
otherwisepublic static final boolean isSimple(Graph graph)
A graph is called simple if it contains no two distinct edges e1, e2
where
e1.source() == e2.source() && e1.target() == e2.target()
.
isMultipleEdgeFree(graph) => isSimple(graph)
.graph
- the given directed graphtrue
if the graph is simple, false
otherwisepublic static final boolean isStronglyConnected(Graph graph)
A graph is called strongly connected if there exists a directed path between each pair of nodes.
graph
- the given directed graphtrue
if the graph is strongly connected, false
, otherwisepublic static final boolean isTree(Graph graph)
isRootedTree(graph) => isTree(graph)
graph
- the given graphtrue
if the graph is an undirected tree, false
otherwise