Interface declaring required functionality for accessing the vertices of an undirected graph in a run of Prim's algorithm for finding a minimum spanning tree. The life-cycle of a vertex is
Edge
,
Iterator
Method Summary | |
Iterator |
getIterator()
Provides the position of this item's vertex in an external data structure. |
double |
getKey()
Provides the key of this item's vertex, if available, that is if this vertex is in state 2 or 3. |
Edge |
getLinkEdge()
Provides the cheapest edge relating this item's vertex to the forest, if available, that is if this vertex is in state 2 or 3. |
void |
intoTree()
Tells this item that its vertex became part of the growing forest, and hereby migrates to state 3. |
boolean |
isKeyAvailable()
Tells whether the vertex of this item is in state 2 or 3. |
boolean |
isTreeVertex()
Tells whether the vertex of this item is in state 3. |
void |
setIterator(Iterator iterator)
Allows to set an iterator position in an external data structure for the vertex held by this item. |
boolean |
update(Edge linkedge,
double key)
Tells this item that its vertex is linked cheapest(ly) to the forest by the given edge. |
Method Detail |
public boolean update(Edge linkedge, double key) throws java.lang.IllegalStateException
linkedge
- the edge linking this item's vertex cheapest(ly)
to the forestkey
- the cost of linking this vertex to the forestjava.lang.IllegalStateException
- if the vertex of this item is already
part of the forest, i.e. in state 3, and thus no edge
can connect it to the forest any moreVertexPropertyItemPrim
public void setIterator(Iterator iterator) throws java.lang.IllegalArgumentException
iterator
- the position of this item's vertex in an
external data structurejava.lang.IllegalArgumentException
- if the iterator pointing to this
item's vertex' position in an external data structure
has already been setpublic void intoTree()
VertexPropertyItemPrim
public Iterator getIterator() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if the iterator pointing to this
item's vertex' position in an external data structure
has not been set, so farsetIterator(Iterator)
public Edge getLinkEdge() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- iff isKeyAvailable()==false
isKeyAvailable()
public double getKey() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- iff isKeyAvailable()==false
isKeyAvailable()
public boolean isKeyAvailable()
VertexPropertyItemPrim
public boolean isTreeVertex()
VertexPropertyItemPrim