|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectopenlist.examples.WeightedDirectedGraph
public class WeightedDirectedGraph
Weighted Directed Graph class to be used for Dijkstra's algorithm
| Nested Class Summary | |
|---|---|
(package private) class |
WeightedDirectedGraph.Arc
Arc represents an arc from a given node to a target nodes, having a specified weight. |
(package private) class |
WeightedDirectedGraph.Node
Node represents a node in the graph, along with distance and predecessor information used by Dijkstra's algorithm. |
| Field Summary | |
|---|---|
(package private) java.util.LinkedList<WeightedDirectedGraph.Node> |
activeNodes
a LinkedList of the active nodes during execution of Dijkstra's algorithm This list will be initialized as a clone of nodes, and retired nodes removed from it. |
(package private) static long |
INFINITY
a large number used to represent infinity distance |
(package private) java.util.LinkedList<WeightedDirectedGraph.Node> |
nodes
a LinkedList of the nodes in the graph in internal form |
(package private) static int |
SOURCE_INDEX
The first node is always the source, by convention. |
| Constructor Summary | |
|---|---|
WeightedDirectedGraph(java.lang.Object raw)
Construct a graph from raw input. |
|
| Method Summary | |
|---|---|
OpenList<java.lang.Object> |
analyze()
analyze conducts Dijkstra's algorithm |
(package private) WeightedDirectedGraph.Node |
findByName(Symbol symbol)
Find a Node by name in the LinkedList of nodes. |
(package private) WeightedDirectedGraph.Node |
findSmallestActiveNode()
Find the active node with the smallest distance, and make it inactive. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final int SOURCE_INDEX
static final long INFINITY
java.util.LinkedList<WeightedDirectedGraph.Node> nodes
java.util.LinkedList<WeightedDirectedGraph.Node> activeNodes
| Constructor Detail |
|---|
public WeightedDirectedGraph(java.lang.Object raw)
raw - OpenList correspding to S expression representing graph| Method Detail |
|---|
public OpenList<java.lang.Object> analyze()
WeightedDirectedGraph.Node findByName(Symbol symbol)
symbol -
WeightedDirectedGraph.Node findSmallestActiveNode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||