|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.amino.ds.graph.AdjacentList<E>
E
- Type of elements contained in AdjacentListpublic class AdjacentList<E>
This class represents adjacent list, which is a frequently used method for storing graph.
Constructor Summary | |
---|---|
AdjacentList(Node<E> head)
Constructs an adjacent list with specified node as the head node. |
Method Summary | |
---|---|
boolean |
addEdge(Edge<E> e)
add a specified edge into this adjacent list. |
boolean |
addEdge(Node<E> node,
double weight)
add a edge into this adjacent list, with specified node and weight. |
int |
compareTo(AdjacentList<E> o)
|
boolean |
containsEdge(E e)
finds in this adjacent list whether there is an edge that has specified node value. |
boolean |
containsEdge(Node<E> e)
finds whether the head node of this adjacent list links to the specified node e. |
boolean |
freeOwnership()
free the ownership. |
java.util.Collection<Edge<E>> |
getEdge(E t)
return all the edges whose one end has the value t in this adjacent list. |
java.util.Collection<Edge<E>> |
getEdge(Node<E> n)
return all the edge linked to node n. |
Node<E> |
getHeadNode()
|
java.util.Collection<Edge<E>> |
getLinkedEdges()
get all linked edges implied by this adjacent list. |
java.util.List<AdjacentNode<E>> |
getLinkedNodes()
|
boolean |
getOwnership()
|
boolean |
removeEdge(E e)
remove specified edge from this adjacent list. |
boolean |
removeEdge(Edge<E> e)
remove a specified edge from this adjacent list. |
boolean |
removeEdge(Node<E> n)
remove all edges connected to specified node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AdjacentList(Node<E> head)
head
- the head node of this adjacent listMethod Detail |
---|
public java.util.List<AdjacentNode<E>> getLinkedNodes()
public Node<E> getHeadNode()
public boolean addEdge(Edge<E> e)
e
- edge to add
public boolean addEdge(Node<E> node, double weight)
node
- the node connected with the head node of this adjacent listweight
- weight of the edge to add
public boolean removeEdge(Edge<E> e)
e
- the edge to remove
public boolean removeEdge(Node<E> n)
n
- the node with edges to be removed
public boolean removeEdge(E e)
e
- the edge to remove
public boolean getOwnership()
public boolean freeOwnership()
public int compareTo(AdjacentList<E> o)
compareTo
in interface java.lang.Comparable<AdjacentList<E>>
public java.util.Collection<Edge<E>> getEdge(Node<E> n)
n
- the target node
public java.util.Collection<Edge<E>> getEdge(E t)
t
- target value
public boolean containsEdge(E e)
e
- target value
public boolean containsEdge(Node<E> e)
e
- target node
public java.util.Collection<Edge<E>> getLinkedEdges()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |