|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.algo.Trees
Provides diverse algorithms and services for tree-structured graphs or subgraphs.
Method Summary | |
static EdgeList |
directTree(Graph tree)
Reverses the edges of the given tree such that it is a directed rooted tree afterwards. |
static EdgeList |
directTree(Graph tree,
Node root)
Reverses the edges of the given tree such that it is a directed rooted tree with the given node as root element. |
static Node |
getCenterRoot(Graph tree)
Returns the center node of an undirected unrooted tree. |
static NodeList |
getLeafNodes(Graph tree,
boolean rooted)
Returns all leaf nodes of the given tree. |
static Node |
getNearestCommonAncestor(Graph tree,
Node root,
boolean rootedDownward,
NodeList nodes)
Returns the nearest common ancestor of a subset of nodes within a directed rooted tree. |
static Node |
getRoot(Graph tree)
Returns the root node of a rooted tree (or reversed rooted tree) or a maximum weight center node as defined in Trees.getWeightedCenterNode(y.base.Graph)
or another node if the graph is not a tree.
|
static EdgeList[] |
getTreeEdges(Graph graph)
Returns an array of EdgeList objects each containing edges of the given graph that belong to maximal tree leaves of the graph. |
static EdgeList[] |
getTreeEdges(Graph graph,
NodeList[] treeNodes)
Same as Trees.getTreeEdges(Graph) but more efficient if
the treeNodes where calculated before by
Trees.getTreeNodes(Graph) . |
static NodeList[] |
getTreeNodes(Graph graph)
Returns a list of NodeList objects each containing nodes of the given graph that belong to a maximal subtree of the graph. |
static NodeList[] |
getUndirectedTreeNodes(Graph graph)
Returns a list of NodeList objects each containing nodes of the given graph that belong to a maximal subtree of the graph. |
static Node |
getWeightedCenterNode(Graph tree)
Finds a node which is used by the greatest number of all paths interconnecting all nodes with each other. |
static Node |
getWeightedCenterNode(Graph tree,
NodeMap intWeight)
Finds a node which is used by the greatest number of all paths interconnecting all nodes with each other. |
static boolean |
isForest(Graph g)
Checks whether the given graph is a forest, i.e. |
static boolean |
isNaryTree(Graph g,
int n)
Checks whether the given graph is a rooted tree where each node has a maximum of n successors. |
static boolean |
isRootedTree(Graph g)
Checks whether the given graph is a rooted tree. |
static boolean |
isTree(Graph g)
Checks whether or not the given graph is an undirected tree. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static EdgeList[] getTreeEdges(Graph graph)
public static EdgeList[] getTreeEdges(Graph graph, NodeList[] treeNodes)
Trees.getTreeEdges(Graph)
but more efficient if
the treeNodes where calculated before by
Trees.getTreeNodes(Graph)
.
treeNodes
- An array of NodeLists formerly calculated by
Trees.getTreeNodes(Graph)
.public static NodeList[] getTreeNodes(Graph graph)
public static NodeList[] getUndirectedTreeNodes(Graph graph)
public static boolean isNaryTree(Graph g, int n)
n
successors.
public static boolean isRootedTree(Graph g)
public static boolean isTree(Graph g)
public static boolean isForest(Graph g)
public static NodeList getLeafNodes(Graph tree, boolean rooted)
degree == 1
in a unrooted/undirected tree, and a node with
outdegree == 0
in a rooted/directed tree.
a
- Parameters:
rooted
- whether or not to consider the tree
as rooted.
public static Node getCenterRoot(Graph tree)
Precondition: !tree.isEmpty()
public static Node getRoot(Graph tree)
Trees.getWeightedCenterNode(y.base.Graph)
or another node if the graph is not a tree.
Precondition: tree.isTree()
or there is exactly one node with indegree == 0
or there is exactly one node with outdegree == 0
Precondition: !tree.isEmpty()
public static EdgeList directTree(Graph tree)
Precondition: The given graph must be a tree.
Precondition: !graph.isEmpty()
public static Node getWeightedCenterNode(Graph tree)
Precondition: The given graph must be a tree (may be undirected).
Precondition: !graph.isEmpty()
public static Node getWeightedCenterNode(Graph tree, NodeMap intWeight)
Precondition: The given graph must be a tree (may be undirected).
Precondition: !graph.isEmpty()
public static EdgeList directTree(Graph tree, Node root)
Precondition: The given graph must be a tree.
Precondition: The given node must be part of the given graph
public static Node getNearestCommonAncestor(Graph tree, Node root, boolean rootedDownward, NodeList nodes)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |