|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--CourseGraph
Maintain the adjacency list (Map of GraphNode's )that represents the DAG
| Constructor Summary | |
CourseGraph()
Create a course graph with a java.util HashMap |
|
| Method Summary | |
void |
addEdge(java.lang.String fromCourseID,
java.lang.String toCourseID)
Add an edge in the DAG- precondition: fromCourseID and toCourseID are both already vertices in the graph, placed there by addNode |
void |
addNode(Course c)
Add a new course vertex to the graph |
boolean |
elementOf(java.lang.String courseID)
Does this courseID represent a vertix in the graph ? |
GraphNode |
getNode(java.lang.String id)
Get a GraphNode at this ID or return null if not present |
int |
getNumVertices()
Return the size of the graph |
static void |
main(java.lang.String[] arg)
Test routine |
void |
topologicalSort()
Displays all possible paths that meet all prerequistes and cover every course. |
java.lang.String |
toString()
Convert the DAG to a String |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public CourseGraph()
| Method Detail |
public int getNumVertices()
public void addNode(Course c)
public GraphNode getNode(java.lang.String id)
public void addEdge(java.lang.String fromCourseID,
java.lang.String toCourseID)
public boolean elementOf(java.lang.String courseID)
public java.lang.String toString()
public void topologicalSort()
public static void main(java.lang.String[] arg)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||