V
- the vertex type; often Coord
public class Node<V> extends BinaryHeap.Node implements java.io.Serializable
BinaryHeap.Node
that also stores a reference to the parent Graph,
a vertex object of type V
, a Map of neighbor Nodes to the appropriate Connection
per Node, an extra
List of those same Connections for faster iteration, and a lot of internal data used by algorithms in this package.Modifier and Type | Field and Description |
---|---|
protected double |
distance
Internal; confirmed distance so far to get to this Node from the start.
|
protected double |
estimate
Internal; estimated distance to get from this Node to the goal.
|
protected Graph<V> |
graph |
protected int |
i
Internal; a utility field used to store depth in some algorithms.
|
protected int |
idHash |
protected int |
lastRunID
Internal; a utility field used to distinguish which algorithm last used this Node.
|
protected java.util.HashMap<Node<V>,Connection<V>> |
neighbors |
protected V |
object |
protected java.util.ArrayList<Connection<V>> |
outEdges |
protected Node<V> |
prev
Internal; a reference to the previous Node in a BinaryHeap.
|
protected boolean |
seen
Internal; tracking bit for whether this Node has been checked during the current algorithm.
|
protected boolean |
visited
Internal; tracking bit for whether this Node has already been visited during the current algorithm.
|
index, value
Modifier | Constructor and Description |
---|---|
protected |
Node(V v,
Graph<V> graph) |
Modifier and Type | Method and Description |
---|---|
protected Connection<V> |
addEdge(Node<V> v,
float weight) |
protected void |
disconnect() |
boolean |
equals(java.lang.Object o) |
java.util.Collection<Connection<V>> |
getConnections() |
protected Connection<V> |
getEdge(Node<V> v) |
V |
getObject() |
int |
hashCode() |
protected Connection<V> |
removeEdge(Node<V> v) |
protected boolean |
resetAlgorithmAttributes(int runID)
|
java.lang.String |
toString() |
getValue
protected final int idHash
protected final V object
protected java.util.HashMap<Node<V>,Connection<V>> neighbors
protected java.util.ArrayList<Connection<V>> outEdges
protected boolean visited
protected boolean seen
protected double distance
protected double estimate
protected int i
protected int lastRunID
protected Connection<V> getEdge(Node<V> v)
protected Connection<V> addEdge(Node<V> v, float weight)
protected Connection<V> removeEdge(Node<V> v)
protected void disconnect()
public java.util.Collection<Connection<V>> getConnections()
public V getObject()
protected boolean resetAlgorithmAttributes(int runID)
runID
is not equal to lastRunID
, this resets the internal fields visited
,
seen
, distance
, estimate
, prev
, and i
, then sets lastRunID
to runID
.runID
- an int that identifies which run of an algorithm is currently activerunID
is equal to lastRunID
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class BinaryHeap.Node
Copyright © Eben Howard 2012–2022. All rights reserved.