|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectHashGraph
public class HashGraph
An implementation of a Graph which stores the nodes and edges in a hash table to allow O(1) testing for inclusion,insertion, removal etc.
Constructor Summary | |
---|---|
HashGraph()
Creates new HashGraph |
|
HashGraph(Graph g)
|
|
HashGraph(int size)
|
Method Summary | |
---|---|
boolean |
add(Object vertex)
Adds vertex to the graph(Optional operation). |
boolean |
addAll(Collection p)
|
boolean |
addEdge(Object vertex1,
Object vertex2)
Adds edge to the graph(Optional operation). |
void |
clear()
|
Object |
clone()
|
boolean |
contains(Object vertex)
Returns whether or not a particular Object is a vertex in the graph. |
boolean |
containsAll(Collection p)
|
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 |
equals(Object p)
|
int |
hashCode()
|
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 |
isEmpty()
|
boolean |
isTree()
Determines whether or not the graph is a tree. |
Iterator |
iterator()
|
static void |
main(String[] args)
|
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 |
removeAll(Collection p)
|
boolean |
removeEdge(Object vertex1,
Object vertex2)
Removes edge from the graph(Optional operation). |
boolean |
retainAll(Collection p)
|
int |
size()
Returns the number of vertices in the graph. |
Object[] |
toArray()
|
Object[] |
toArray(Object[] p)
|
Set |
vertices()
Construct an Iterator over all vertices. |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashGraph()
public HashGraph(Graph g)
public HashGraph(int size)
Method Detail |
---|
public Graph createIsomorphic(Map mapping)
createIsomorphic
in interface Graph
public Object clone()
clone
in class Object
public Set vertices()
vertices
in interface Graph
public Set neighbors(Object vertex)
neighbors
in interface Graph
vertex-
- An Object which is in the graph.public Set neighboringEdges(Object vertex)
neighboringEdges
in interface Graph
public int degree(Object vertex)
degree
in interface Graph
vertex-
- An Object which is in the graph.public boolean containsEdge(Object vertex1, Object vertex2)
containsEdge
in interface Graph
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.public boolean containsEdge(Edge e)
containsEdge
in interface Graph
public boolean contains(Object vertex)
contains
in interface Graph
contains
in interface Collection
vertex-
- Any Object.public int size()
size
in interface Graph
size
in interface Collection
public boolean isAcyclic()
isAcyclic
in interface Graph
public boolean isConnected()
isConnected
in interface Graph
public boolean isConnected(Object vertex1, Object vertex2)
isConnected
in interface Graph
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.public boolean isTree()
isTree
in interface Graph
public boolean add(Object vertex)
add
in interface Graph
add
in interface Collection
vertex-
- An Object which is not in the graph.public boolean remove(Object vertex)
remove
in interface Graph
remove
in interface Collection
vertex-
- An Object which is currently in the graph.public boolean addEdge(Object vertex1, Object vertex2)
addEdge
in interface Graph
vertex1-An
- Object which is currently in the graph.vertex2-An
- Object which is currently in the graph.public boolean removeEdge(Object vertex1, Object vertex2)
removeEdge
in interface Graph
vertex1-An
- Object which is currently in the graph.vertex2-An
- Object which is currently in the graph.public boolean retainAll(Collection p)
retainAll
in interface Collection
public Object[] toArray(Object[] p)
toArray
in interface Collection
public Object[] toArray()
toArray
in interface Collection
public boolean removeAll(Collection p)
removeAll
in interface Collection
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
public void clear()
clear
in interface Collection
public int hashCode()
hashCode
in interface Collection
hashCode
in class Object
public boolean addAll(Collection p)
addAll
in interface Collection
public boolean containsAll(Collection p)
containsAll
in interface Collection
public boolean isEmpty()
isEmpty
in interface Collection
public boolean equals(Object p)
equals
in interface Collection
equals
in class Object
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |