com.infomancers.collections.graph
Interface GraphAdapter


public interface GraphAdapter

Used as an adapter between an already existing graph model and this collections library.

The graph is supposed to support two things: 1. Ability to determine a specific node in the graph based on an index, 2. Ability to retrieve list of neighbours of a node.

The graph doesn't have to be bi-directional, and the graph adapter doesn't have to be implemented as such.


Method Summary
 java.lang.Object getNode(int index)
          Retrieves a node at a certain index.
 java.lang.Iterable<java.lang.Object> getNodeNeighbours(java.lang.Object node)
          Retreves the list of a node's neighbours.
 

Method Detail

getNode

java.lang.Object getNode(int index)
Retrieves a node at a certain index.

As long as nodes are not being added or deleted, it is assured that a certain index will retrieve the same node.

Parameters:
index - The index of the node.
Returns:
A node.

getNodeNeighbours

java.lang.Iterable<java.lang.Object> getNodeNeighbours(java.lang.Object node)
Retreves the list of a node's neighbours.

Parameters:
node - The node to retrieve its neighbours.
Returns:
The neighbour nodes.