jebl.evolution.trees
Interface RootedTree

All Superinterfaces:
Attributable, Graph, Tree
All Known Implementing Classes:
CompactRootedTree, FilteredRootedTree, MutableRootedTree, RootedFromUnrooted, SimpleRootedTree, SortedRootedTree, TransformedRootedTree

public interface RootedTree
extends Tree

A tree with a root (node with maximum height). This interface provides the concept of a direction of time that flows from the root to the tips. Each node in the tree has a node height that is less than its parent's height and greater than it children's heights.

Author:
rambaut, Alexei Drummond

Nested Class Summary
 
Nested classes/interfaces inherited from interface jebl.evolution.graphs.Graph
Graph.NoEdgeException, Graph.Utils
 
Method Summary
 boolean conceptuallyUnrooted()
          Deprecated. This should be removed. If this is a rooted tree then it is rooted. This can really only confuse things. Trees are unrooted, RootedTrees are rooted. This is not an implementation limitation. It may be that a RootedTree has an arbitrary root but it is still rooted. With a rooted tree, it is convenient to store branch information at the node (i.e., for the branch above the node) because there is no "branch" object. Andrew.
 List<Node> getChildren(Node node)
           
 double getHeight(Node node)
           
 double getLength(Node node)
           
 Node getParent(Node node)
           
 Node getRootNode()
          The root of the tree has the largest node height of all nodes in the tree.
 boolean hasHeights()
           
 boolean hasLengths()
           
 boolean isRoot(Node node)
           
 
Methods inherited from interface jebl.evolution.trees.Tree
getExternalEdges, getExternalNodes, getInternalEdges, getInternalNodes, getNode, getTaxa, getTaxon, isExternal
 
Methods inherited from interface jebl.evolution.graphs.Graph
getAdjacencies, getEdge, getEdgeLength, getEdges, getEdges, getNodes, getNodes, getNodes
 
Methods inherited from interface jebl.util.Attributable
getAttribute, getAttributeMap, getAttributeNames, removeAttribute, setAttribute
 

Method Detail

getChildren

List<Node> getChildren(Node node)
Parameters:
node - the node whose children are being requested.
Returns:
the list of nodes that are the children of the given node. The set may be empty for a terminal node (a tip).

hasHeights

boolean hasHeights()
Returns:
Whether this tree has node heights available

getHeight

double getHeight(Node node)
Parameters:
node - the node whose height is being requested.
Returns:
the height of the given node. The height will be less than the parent's height and greater than it children's heights.

hasLengths

boolean hasLengths()
Returns:
Whether this tree has branch lengths available

getLength

double getLength(Node node)
Parameters:
node - the node whose branch length (to its parent) is being requested.
Returns:
the length of the branch to the parent node (0.0 if the node is the root).

getParent

Node getParent(Node node)
Parameters:
node - the node whose parent is requested
Returns:
the parent node of the given node, or null if the node is the root node.

getRootNode

Node getRootNode()
The root of the tree has the largest node height of all nodes in the tree.

Returns:
the root of the tree.

conceptuallyUnrooted

boolean conceptuallyUnrooted()
Deprecated. This should be removed. If this is a rooted tree then it is rooted. This can really only confuse things. Trees are unrooted, RootedTrees are rooted. This is not an implementation limitation. It may be that a RootedTree has an arbitrary root but it is still rooted. With a rooted tree, it is convenient to store branch information at the node (i.e., for the branch above the node) because there is no "branch" object. Andrew.

Due to current implementation limitations, trees store "branch" information in nodes. So, internally rooted trees are genetrated when un-rooted would be more natural.

Returns:
true if tree(s) are to be viewed as unrooted

isRoot

boolean isRoot(Node node)
Parameters:
node - the node
Returns:
true if the node is the root of this tree.