public class MazeGraph extends WeightedGraph<Juncture>
The MazeGraph is an extension of WeightedGraph. The constructor converts a Maze into a graph.
| Constructor and Description |
|---|
MazeGraph(Maze maze)
Construct the MazeGraph using the "maze" contained
in the parameter to specify the vertices (Junctures)
and weighted edges.
|
addEdge, addObserver, addVertex, containsVertex, DoBFS, DoDFS, DoDijsktra, getWeightpublic MazeGraph(Maze maze)
Construct the MazeGraph using the "maze" contained in the parameter to specify the vertices (Junctures) and weighted edges.
The Maze is a rectangular grid of "junctures", each defined by its X and Y coordinates, using the usual convention of (0, 0) being the upper left corner.
Each juncture in the maze should be added as a vertex to this graph.
For every pair of adjacent junctures (A and B) which are not blocked by a wall, two edges should be added: One from A to B, and another from B to A. The weight to be used for these edges is provided by the Maze. (The Maze methods getMazeWidth and getMazeHeight can be used to determine the number of Junctures in the maze. The Maze methods called "isWallAbove", "isWallToRight", etc. can be used to detect whether or not there is a wall between any two adjacent junctures. The Maze methods called "getWeightAbove", "getWeightToRight", etc. should be used to obtain the weights.)
maze - to be used as the source of information for
adding vertices and edges to this MazeGraph.