uk.ed.inf.graph.basic
Interface IBasicGraph<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

All Known Subinterfaces:
IBasicSubgraph<N,E>, IChildCompoundGraph<N,E>, IColouredGraph<N,E>, ICompoundGraph<N,E>, IDirectedGraph<N,E>, IDirectedSubgraph<N,E>, ISubCompoundGraph<N,E>, IUndirectedGraph<N,E>, IUndirectedSubgraph<N,E>
All Known Implementing Classes:
ArchetypalChildCompoundGraph, ArchetypalCompoundGraph, BaseChildCompoundGraph, BaseCompoundGraph, BaseSubCompoundGraph, ChildCompoundGraph, CompoundGraph, Graph, SubCompoundGraph, Subgraph

public interface IBasicGraph<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>


Method Summary
 boolean containsConnection(IBasicPair<? extends N,? extends E> ends)
          Tests if the graph has an edge between the defined ends.
 boolean containsConnection(N thisNode, N thatNode)
          Tests if the graph contains an edge connecting these nodes.
 boolean containsEdge(E edge)
          Tests if the graph contains the edge.
 boolean containsEdge(int edgeIdx)
          Tests if the graph contains the edge of the given index.
 boolean containsNode(int nodeIdx)
          Tests if the graph contains the node with the given index number.
 boolean containsNode(N node)
          Tests if this node exists in the graph.
 java.util.Iterator<E> edgeIterator()
          Get an iterator that traverses all the edges in this graph.
 E getEdge(int edgeIdx)
          Get the edge with this index.
 N getNode(int nodeIdx)
          Get the node matching the nodeIdx.
 int getNumEdges()
          Get the number of edges in the graph.
 int getNumNodes()
          Get the number of nodes in the graph.
 java.util.Iterator<N> nodeIterator()
          Get an iterator that traverses all the nodes in this graph.
 

Method Detail

getNumNodes

int getNumNodes()
Get the number of nodes in the graph.

Returns:
The number of nodes.

getNumEdges

int getNumEdges()
Get the number of edges in the graph.

Returns:
The number of edges.

containsNode

boolean containsNode(int nodeIdx)
Tests if the graph contains the node with the given index number.

Parameters:
nodeIdx - The index number of the node.
Returns:
True if the graph contains the node, false otherwise.

getNode

N getNode(int nodeIdx)
Get the node matching the nodeIdx.

Parameters:
nodeIdx - the node index to lookup.
Returns:
the node matching the index. Cannot be null.
Throws:
java.lang.IllegalArgumentException - if node does not exists, i.e. containsNode(nodeIdx) == false

containsNode

boolean containsNode(N node)
Tests if this node exists in the graph.

Parameters:
node - to be tested.
Returns:
True if the graph contains the node, false otherwise.

containsConnection

boolean containsConnection(N thisNode,
                           N thatNode)
Tests if the graph contains an edge connecting these nodes. Ignores the direction of the edge.

Parameters:
thisNode - a node to test.
thatNode - the other node to test.
Returns:
true if the edge exists, false otherwise.

containsEdge

boolean containsEdge(E edge)
Tests if the graph contains the edge.

Parameters:
edge - the edge to test.
Returns:
true if the edge exists in the graph, false otherwise.

containsConnection

boolean containsConnection(IBasicPair<? extends N,? extends E> ends)
Tests if the graph has an edge between the defined ends.

Parameters:
ends - the ends of the edge to test.
Returns:
true if the edge exists in the graph, false otherwise.

containsEdge

boolean containsEdge(int edgeIdx)
Tests if the graph contains the edge of the given index.

Parameters:
edgeIdx - the index to test.
Returns:
true if matching edge can be found, false otherwise.

getEdge

E getEdge(int edgeIdx)
Get the edge with this index.

Parameters:
edgeIdx - The index of the edge.
Returns:
The edge matching the index.
Throws:
java.lang.IllegalArgumentException - if an edge matching this index does not exist, i.e. containsEdge(edgeIdx) == false.

nodeIterator

java.util.Iterator<N> nodeIterator()
Get an iterator that traverses all the nodes in this graph. The traversal order is not guaranteed, but all nodes will be traversed.

Returns:
The node iterator, guaranteed to be non-null.

edgeIterator

java.util.Iterator<E> edgeIterator()
Get an iterator that traverses all the edges in this graph. No traversal order is guaranteed.

Returns:
The edge iterator, guaranteed to be non-null.