|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
The interface describing undirected graphs. Any object may be a vertex. Following the convention of the Collection interface, some operations are optional. In this case the modification methods are all optionali allowing for mutable or immutable graphs. Typically the definition of a graph requires a non-empty set of vertices. We will slightly abuse the term by allowing empty graphs(graphs with no vertices). This is done in order to simplify incremental creation and destruction of the graph, as well as to conform to the conventions of the Collection interface. The inspiration for this interface comes from the book Structures in Java.i In many respects the implementation is similar.
Method Summary | |
---|---|
boolean |
add(Object vertex)
Adds vertex to the graph(Optional operation). |
boolean |
addEdge(Object vertex1,
Object vertex2)
Adds edge to the graph(Optional operation). |
boolean |
contains(Object vertex)
Returns whether or not a particular Object is a vertex in the graph. |
boolean |
containsEdge(Edge e)
|
boolean |
containsEdge(Object vertex1,
Object vertex2)
Returns whether or not a particular edge is in the graph. |
Graph |
createIsomorphic(Map mapping)
|
int |
degree(Object vertex)
Returns the degree of vertex. |
boolean |
isAcyclic()
Determines whether or not the graph is acyclic. |
boolean |
isConnected()
Determines whether or not the graph is connected. |
boolean |
isConnected(Object vertex1,
Object vertex2)
Determines if there is a path from vertex1 to vertex2. |
boolean |
isTree()
Determines whether or not the graph is a tree. |
Set |
neighboringEdges(Object vertex)
|
Set |
neighbors(Object vertex)
Construct an Iterator over the vertices adjacent to vertex. |
boolean |
remove(Object vertex)
Removes vertex from the graph(Optional operation). |
boolean |
removeEdge(Object vertex1,
Object vertex2)
Removes edge from the graph(Optional operation). |
int |
size()
Returns the number of vertices in the graph. |
Set |
vertices()
Return the set of verticies. |
Methods inherited from interface Collection |
---|
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, toArray, toArray |
Method Detail |
---|
Set vertices()
Set neighbors(Object vertex)
vertex-
- An Object which is in the graph.Set neighboringEdges(Object vertex)
int degree(Object vertex)
vertex-
- An Object which is in the graph.boolean containsEdge(Object vertex1, Object vertex2)
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.boolean containsEdge(Edge e)
boolean contains(Object vertex)
contains
in interface Collection
vertex-
- Any Object.int size()
size
in interface Collection
boolean isAcyclic()
boolean isConnected()
boolean isConnected(Object vertex1, Object vertex2)
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.boolean isTree()
boolean add(Object vertex)
add
in interface Collection
vertex-
- An Object which is not in the graph.boolean remove(Object vertex)
remove
in interface Collection
vertex-
- An Object which is currently in the graph.boolean addEdge(Object vertex1, Object vertex2)
vertex1-An
- Object which is currently in the graph.vertex2-An
- Object which is currently in the graph.boolean removeEdge(Object vertex1, Object vertex2)
vertex1-An
- Object which is currently in the graph.vertex2-An
- Object which is currently in the graph.Graph createIsomorphic(Map mapping)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |