public interface IPFMap<NODE>
The map is perceived as oriented graph that does not have "multi-edges" (it is not a multigraph).
Every environment must at least provide:
getNeighbors(Object))getNodeCost(Object))IPFMap#getArcCost(Object))
Note that the interface is parameterized by "NODE" which might be arbitrary object, that is you may use POJOs here. But be careful
as algorithms using the map usually assumes that Object.hashCode() and Object.equals(Object) are correctly implemented
for them (i.e., they may use the nodes as keys inside HashMaps).
Note that the implementation of such interface should not provide any "view hacks", i.e., means for suppressing the presence of some nodes/arc of the graph.
Such tweaks should be implemented using IPFMapView.
Note that this interface is suitable for "exploratory" algorithms such as A-Star, that is, algorithms which gradually search the space given some "seed" (starting point).
If you wish to use "grand-scale" algorithms such as Floyd-Warshall (where you have to know number of all nodes in advance), use IPFKnownMap.
| Modifier and Type | Method and Description |
|---|---|
int |
getArcCost(NODE nodeFrom,
NODE nodeTo)
Should return the cost of traveling from "nodeFrom" to "nodeTo".
|
Collection<NODE> |
getNeighbors(NODE node)
This should return a collection of nodes which are connected to this one by some arc (== oriented edge).
|
int |
getNodeCost(NODE node)
General cost of having this node at your path.
|
Collection<NODE> getNeighbors(NODE node)
"node" MUST NOT BE PART OF THE COLLECTION!
Returned collection must not contain multiple references to a single neighbor (multi-graph is forbidden).
node - int getNodeCost(NODE node)
This might be highly dependent on the agent so the default implementation will probably just return "0".
node - int getArcCost(NODE nodeFrom, NODE nodeTo)
getNeighbors(Object) or from IPFMapView#getExtraNeighbors(Object).
Note that notion of "cost" might be highly dependent on the agent, thus it may have the sense to provide it only a general distance between "nodeFrom" and "nodeTo".
The method can be also perceived as having name "getDistance".
nodeFrom - nodeTo - Copyright © 2018 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All rights reserved.