|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
A general graph interface. It follows the following model: the graph has n nodes which are indexed from 0 to n-1. The parameters of operators refer to indices only. Implementations might return objects that represent the nodes or edges, although this is not required. Undirected graphs are modelled by the interface as directed graphs in which every edge (i,j) has a corresponding reverse edge (j,i).
Method Summary | |
---|---|
boolean |
clearEdge(int i,
int j)
Removes given edge, returns true if it existed before. |
int |
degree(int i)
Returns the degree of the given node. |
boolean |
directed()
Returns true if the graph is directed otherwise false. |
java.lang.Object |
getEdge(int i,
int j)
Returns the edge object associated with the index. |
java.util.Collection<java.lang.Integer> |
getNeighbours(int i)
Returns a collection view to all outgoing edges from i. |
java.lang.Object |
getNode(int i)
Returns the node object associated with the index. |
boolean |
isEdge(int i,
int j)
Returns true if there is a directed edge between node i and node j. |
boolean |
setEdge(int i,
int j)
Sets given edge, returns true if it did not exist before. |
int |
size()
The number of nodes in the graph. |
Method Detail |
---|
boolean isEdge(int i, int j)
java.util.Collection<java.lang.Integer> getNeighbours(int i)
java.lang.Object getNode(int i)
java.lang.Object getEdge(int i, int j)
int size()
boolean directed()
boolean setEdge(int i, int j)
boolean clearEdge(int i, int j)
int degree(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |