|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graph.model.GraphOperations
Class GraphOperations provides static methods to analyze and
modify a graph. Most of the methods depend on the graph algorithm package
and represent convenience methods that answer a particular question about
a graph. The algorithm package provides more generic algorithms which
usually do more than the helper methods in this class.
If you just have a simple question about the graph then you should use
this class. If you need to customize a graph algorithm, please look at the
underlying algorithms located in package
com.tensegrity.graph.algorithm.
| Method Summary | |
static Node |
findRoot(Graph graph)
Returns the root node of the given graph if it is a tree and has a single root, otherwise null is returned. |
static boolean |
hasCycle(Graph graph)
Checks whether the given directed graph has a cycle by means of topological searching. |
static boolean |
isBiconnected(Graph graph)
Returns true if the given undirected graph consists
of one biconnected component only. |
static boolean |
isBinaryTree(Graph graph)
Checks whether the graph is a binary tree. |
static boolean |
isConnected(Graph graph)
Finds out whether the undirected instance of the given graph is connected. |
static boolean |
isTree(Graph graph)
Performs the full set of conditional checks to determine whether the given Graph is a tree and has at least one root.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final boolean isConnected(Graph graph)
graph - the graph to investigate
true if the undirected instance of the graph is
connected.public static final boolean isBiconnected(Graph graph)
true if the given undirected graph consists
of one biconnected component only. Use the search algorithm implemented in class
com.tensegrity.graph.alorithm.BiconnectedDFS to find out the biconnected
components.
graph - the graph to investigate
true if the undirected instance of the graph is
biconnected.public static final boolean hasCycle(Graph graph)
graph - the directed Graph to investigate.
true if the directed instance of the graph has a cycle.public static final boolean isTree(Graph graph)
Graph is a tree and has at least one root.
A graph is a tree if the following is true:
True is returned if all tests succeed.
graph - the Graph to investigate.
true if the graph is a tree.findRoot(Graph)public static final boolean isBinaryTree(Graph graph)
tree-criteria as in method
isTree(Graph)
must be met. Additionally all non-leaf nodes of the tree must have
a leaving edge degree lesser than 3.
graph - the graph to investigate
true if the graph is a treeisTree(Graph)public static final Node findRoot(Graph graph)
null is returned. This method can be used to determine whether
a graph meets one of the necessary conditions of a tree.
graph - the Graph to investigate
null.isTree(Graph)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||