|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectStateGraph
public class StateGraph
This class represents the adjacency relationships between US states. (More generally, it could be used to represent any unweighted directed graph.)
| Constructor Summary | |
|---|---|
StateGraph(java.lang.String fileName)
Build a StateGraph from a file. |
|
| Method Summary | |
|---|---|
State |
getState(java.lang.String name)
Return the vertex with the indicated name. |
java.util.ArrayList<State> |
getStates()
Return a list of all vertices in the graph. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StateGraph(java.lang.String fileName)
throws java.io.FileNotFoundException
Alaska Alabama,Mississippi,Tennessee,Georgia,FloridaNo state may be listed as a neighbor if it does not begin some line in the file.
fileName - The name of the file containing the graph
specification.
java.io.FileNotFoundException - If the file cannot be opened
for reading.| Method Detail |
|---|
public java.util.ArrayList<State> getStates()
public State getState(java.lang.String name)
name - The name of the desired State.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||