|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjebl.evolution.trees.CompactRootedTree
public class CompactRootedTree
A memory efficient rooted tree. - Uses a compact representation for the tree structure based primarily on indices instead of pointers and objects - Minimize penalty for unused features. Trees not using attributes or edges do not require additional per node/edge memory. Limitations: - Maximun of 2^16 nodes and 2^15 external nodes. This should not be a problem with the current sizes of phlogenetic trees we currently handle. - Some of the accessors are slower, typically the ones getting all nodes, all edges, all internal nodes etc. Traversing the tree and handling attributes speed should be fine (compared to SimpkeRootedTree)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface jebl.evolution.graphs.Graph |
|---|
Graph.NoEdgeException, Graph.Utils |
| Constructor Summary | |
|---|---|
CompactRootedTree(RootedTree t)
Do all the hard work. |
|
| Method Summary | |
|---|---|
boolean |
conceptuallyUnrooted()
Due to current implementation limitations, trees store "branch" information in nodes. |
List<Node> |
getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge |
Object |
getAttribute(String name)
|
Map<String,Object> |
getAttributeMap()
Gets the entire attribute map. |
Set<String> |
getAttributeNames()
|
List<Node> |
getChildren(Node node)
|
Edge |
getEdge(Node node1,
Node node2)
Returns the Edge that connects these two nodes |
double |
getEdgeLength(Node node1,
Node node2)
Returns the length of the edge that connects these two nodes |
Set<Edge> |
getEdges()
|
List<Edge> |
getEdges(Node node)
Returns a list of edges connected to this node |
Set<Edge> |
getExternalEdges()
|
Set<Node> |
getExternalNodes()
|
double |
getHeight(Node node)
|
Set<Edge> |
getInternalEdges()
|
Set<Node> |
getInternalNodes()
|
double |
getLength(Node node)
|
Node |
getNode(Taxon taxon)
|
Set<Node> |
getNodes()
|
Node[] |
getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge. |
Set<Node> |
getNodes(int degree)
|
Node |
getParent(Node node)
|
Node |
getRootNode()
The root of the tree has the largest node height of all nodes in the tree. |
Set<Taxon> |
getTaxa()
|
Taxon |
getTaxon(Node node)
|
boolean |
hasHeights()
|
boolean |
hasLengths()
|
boolean |
isExternal(Node node)
|
boolean |
isRoot(Node node)
|
void |
removeAttribute(String name)
|
void |
setAttribute(String name,
Object value)
Sets an named attribute for this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jebl.util.Attributable |
|---|
getAttribute, getAttributeMap, getAttributeNames, removeAttribute, setAttribute |
| Constructor Detail |
|---|
public CompactRootedTree(RootedTree t)
t - | Method Detail |
|---|
public List<Node> getChildren(Node node)
getChildren in interface RootedTreenode - the node whose children are being requested.
public boolean hasHeights()
hasHeights in interface RootedTreepublic double getHeight(Node node)
getHeight in interface RootedTreenode - the node whose height is being requested.
public boolean hasLengths()
hasLengths in interface RootedTreepublic double getLength(Node node)
getLength in interface RootedTreenode - the node whose branch length (to its parent) is being requested.
public Node getParent(Node node)
getParent in interface RootedTreenode - the node whose parent is requested
public Node getRootNode()
RootedTree
getRootNode in interface RootedTreepublic boolean conceptuallyUnrooted()
RootedTree
conceptuallyUnrooted in interface RootedTreepublic boolean isRoot(Node node)
isRoot in interface RootedTreenode - the node
public Set<Node> getExternalNodes()
getExternalNodes in interface Treepublic Set<Node> getInternalNodes()
getInternalNodes in interface Treepublic Set<Edge> getExternalEdges()
getExternalEdges in interface Treepublic Set<Edge> getInternalEdges()
getInternalEdges in interface Treepublic Set<Taxon> getTaxa()
getTaxa in interface Treepublic Taxon getTaxon(Node node)
getTaxon in interface Treenode - the node whose associated taxon is being requested.
public boolean isExternal(Node node)
isExternal in interface Treenode - the node
public Node getNode(Taxon taxon)
getNode in interface Treetaxon - the taxon
public List<Edge> getEdges(Node node)
Graph
getEdges in interface Graphpublic List<Node> getAdjacencies(Node node)
Graph
getAdjacencies in interface Graph
public Edge getEdge(Node node1,
Node node2)
throws Graph.NoEdgeException
Graph
getEdge in interface GraphGraph.NoEdgeException - if the nodes are not directly connected by an edge.
public double getEdgeLength(Node node1,
Node node2)
throws Graph.NoEdgeException
Graph
getEdgeLength in interface GraphGraph.NoEdgeException - if the nodes are not directly connected by an edge.public Node[] getNodes(Edge edge)
Graph
getNodes in interface Graphpublic Set<Node> getNodes()
getNodes in interface Graphpublic Set<Edge> getEdges()
getEdges in interface Graphpublic Set<Node> getNodes(int degree)
getNodes in interface Graphdegree - the number of edges connected to a node
public void setAttribute(String name,
Object value)
Attributable
setAttribute in interface Attributablename - the name of the attribute.value - the new value of the attribute.public Object getAttribute(String name)
getAttribute in interface Attributablename - the name of the attribute of interest.
public void removeAttribute(String name)
removeAttribute in interface Attributablename - name of attribute to removepublic Set<String> getAttributeNames()
getAttributeNames in interface Attributablepublic Map<String,Object> getAttributeMap()
Attributable
getAttributeMap in interface Attributable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||