jebl.evolution.graphs
Interface Graph

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

public interface Graph
extends Attributable

Author:
Andrew Rambaut, Alexei Drummond

Nested Class Summary
static class Graph.NoEdgeException
          This class is thrown by getEdgeLength(node1, node2) if node1 and node2 are not directly connected by an edge.
static class Graph.Utils
           
 
Method Summary
 List<Node> getAdjacencies(Node node)
          Returns a list of nodes connected to this node by an edge
 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<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)
           
 
Methods inherited from interface jebl.util.Attributable
getAttribute, getAttributeMap, getAttributeNames, removeAttribute, setAttribute
 

Method Detail

getEdges

List<Edge> getEdges(Node node)
Returns a list of edges connected to this node

Parameters:
node -
Returns:
the set of nodes that are attached by edges to the given node.

getAdjacencies

List<Node> getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge

Parameters:
node -
Returns:
the set of nodes that are attached by edges to the given node.

getEdge

Edge getEdge(Node node1,
             Node node2)
             throws Graph.NoEdgeException
Returns the Edge that connects these two nodes

Parameters:
node1 -
node2 -
Returns:
the edge object.
Throws:
Graph.NoEdgeException - if the nodes are not directly connected by an edge.

getEdgeLength

double getEdgeLength(Node node1,
                     Node node2)
                     throws Graph.NoEdgeException
Returns the length of the edge that connects these two nodes

Parameters:
node1 -
node2 -
Returns:
the edge length.
Throws:
Graph.NoEdgeException - if the nodes are not directly connected by an edge.

getNodes

Node[] getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge.

Parameters:
edge -
Returns:
an array of 2 edges

getNodes

Set<Node> getNodes()
Returns:
the set of all nodes in this graph.

getEdges

Set<Edge> getEdges()
Returns:
the set of all edges in this graph.

getNodes

Set<Node> getNodes(int degree)
Parameters:
degree - the number of edges connected to a node
Returns:
a set containing all nodes in this graph of the given degree.