edu.uconn.mcb.lineageevolver.graph
Interface DirectedGraph

All Known Subinterfaces:
GraphTopology
All Known Implementing Classes:
EdgeListGraph, EdgeListGraphTopology

public interface DirectedGraph

Common interface for all graph objects.

Author:
Hasan Khalil

Method Summary
 GraphEdge addEdge(java.lang.Object data, GraphNode origin, GraphNode destination)
          Adds an edge to this graph.
 GraphNode addNode(java.lang.Object data)
          Adds a node to this graph.
 GraphNode[] getAdjacentNodes(GraphNode v)
          Retrieves all nodes directly adjacent to the given node.
 java.lang.Object getData(GraphEdge e)
          Returns the data stored inside a given edge.
 java.lang.Object getData(GraphNode v)
          Returns the data stored inside a given node.
 GraphEdge[] getEdges(GraphNode v)
          Retrieves all edges outgoing from a given node.
 GraphNode[] getNodes()
          Retrieves all nodes in this graph.
 GraphNode[] getNodes(GraphEdge e)
          Retrieves the two nodes connected by a given edge.
 void setData(GraphEdge e, java.lang.Object data)
          Sets the data for a given edge.
 void setData(GraphNode v, java.lang.Object data)
          Sets the data for a given node.
 

Method Detail

getEdges

public GraphEdge[] getEdges(GraphNode v)
Retrieves all edges outgoing from a given node.

Parameters:
v - the node for which to retrieve the edges.
Returns:
an array containing all edges outgoing from the given node.

getNodes

public GraphNode[] getNodes(GraphEdge e)
Retrieves the two nodes connected by a given edge.

Parameters:
e - the edge for which to retrieve the nodes.
Returns:
an array containing the two nodes connected to the given edge, with the origin node first, and the destination node last.

addNode

public GraphNode addNode(java.lang.Object data)
Adds a node to this graph.

Parameters:
data - the data to store in the new node.
Returns:
the newly created node.

addEdge

public GraphEdge addEdge(java.lang.Object data,
                         GraphNode origin,
                         GraphNode destination)
Adds an edge to this graph.

Parameters:
data - the data to store in the new edge.
origin - the origin node of this edge.
destination - the destination node of this edge.
Returns:
the newly created edge.

getNodes

public GraphNode[] getNodes()
Retrieves all nodes in this graph.

Returns:
an array containing all nodes in this graph, in no assured order.

getData

public java.lang.Object getData(GraphNode v)
Returns the data stored inside a given node.

Parameters:
v - the node from which to retrieve data.
Returns:
the data contained in the given node.

getData

public java.lang.Object getData(GraphEdge e)
Returns the data stored inside a given edge.

Parameters:
e - the edge from which to retrieve data.
Returns:
the data contained in the given edge.

setData

public void setData(GraphNode v,
                    java.lang.Object data)
Sets the data for a given node.

Parameters:
v - the node for which to set the data.
data - the data to store inside the given node.

setData

public void setData(GraphEdge e,
                    java.lang.Object data)
Sets the data for a given edge.

Parameters:
e - the edge for which to set the data.
data - the data to store inside the given edge.

getAdjacentNodes

public GraphNode[] getAdjacentNodes(GraphNode v)
Retrieves all nodes directly adjacent to the given node. This means that they are reachable via the traversal of one edge.

Parameters:
v - the node for which to retrieve adjacent nodes.
Returns:
an array containing all adjacent nodes to the given node.