Package org.jungrapht.visualization.util
Class TreeUtils
- java.lang.Object
- 
- org.jungrapht.visualization.util.TreeUtils
 
- 
 public class TreeUtils extends Object 
- 
- 
Constructor SummaryConstructors Constructor Description TreeUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,E>
 voidaddSubTree(org.jgrapht.Graph<V,E> tree, org.jgrapht.Graph<V,E> subTree, V subTreeParent, E connectingEdge)ConnectssubTreetotreeby attaching it as a child ofsubTreeParentwith edgeconnectingEdge.static <V,E>
 org.jgrapht.Graph<V,E>getSubTree(org.jgrapht.Graph<V,E> tree, V root)Returns a copy of the subtree oftreewhich is rooted atroot.static <V,E>
 voidgrowSubTree(org.jgrapht.Graph<V,E> tree, org.jgrapht.Graph<V,E> subTree, V root)Populatessubtreewith the subtree oftreewhich is rooted atroot.static <V> booleanisForestShaped(org.jgrapht.Graph<V,?> graph)A graph is "forest-shaped" if it is directed, acyclic, and each vertex has at most one predecessor.static <V,E>
 voidremoveTreeVertex(org.jgrapht.Graph<V,E> tree, V subRoot)removes a vertex and all descendants from a treestatic <V> Set<V>roots(org.jgrapht.Graph<V,?> graph)
 
- 
- 
- 
Method Detail- 
rootspublic static <V> Set<V> roots(org.jgrapht.Graph<V,?> graph) 
 - 
isForestShapedpublic static <V> boolean isForestShaped(org.jgrapht.Graph<V,?> graph) A graph is "forest-shaped" if it is directed, acyclic, and each vertex has at most one predecessor.
 - 
getSubTreepublic static <V,E> org.jgrapht.Graph<V,E> getSubTree(org.jgrapht.Graph<V,E> tree, V root)Returns a copy of the subtree oftreewhich is rooted atroot.- Type Parameters:
- V- the vertex type
- E- the edge type
- Parameters:
- tree- the tree whose subtree is to be extracted
- root- the root of the subtree to be extracted
 
 - 
growSubTreepublic static <V,E> void growSubTree(org.jgrapht.Graph<V,E> tree, org.jgrapht.Graph<V,E> subTree, V root)Populatessubtreewith the subtree oftreewhich is rooted atroot.- Type Parameters:
- V- the vertex type
- E- the edge type
- Parameters:
- tree- the tree whose subtree is to be extracted
- subTree- the tree instance which is to be populated with the subtree of- tree
- root- the root of the subtree to be extracted
 
 - 
addSubTreepublic static <V,E> void addSubTree(org.jgrapht.Graph<V,E> tree, org.jgrapht.Graph<V,E> subTree, V subTreeParent, E connectingEdge)ConnectssubTreetotreeby attaching it as a child ofsubTreeParentwith edgeconnectingEdge.- Type Parameters:
- V- the vertex type
- E- the edge type
- Parameters:
- tree- the tree to which- subTreeis to be added
- subTree- the tree which is to be grafted on to- tree
- subTreeParent- the parent of the root of- subTreein its new position in- tree
- connectingEdge- the edge used to connect- subTreeParentto- subtree's root
 
 - 
removeTreeVertexpublic static <V,E> void removeTreeVertex(org.jgrapht.Graph<V,E> tree, V subRoot)removes a vertex and all descendants from a tree- Type Parameters:
- V- the vertex type
- E- the edge type
- Parameters:
- tree- the tree to mutate
- subRoot- the vertex to remove
 
 
- 
 
-