@@ -0,0 +1,877 @@
+public class criticalpath %7B%0A%09public static digraph criticalpathanalysis(digraph g) %7B%0A%09%09int n = g.getNumberOfVertices();%0A%09%09int%5B%5D earliestTime = new int%5Bn%5D;%0A%09%09earliestTime%5B0%5D = 0;%0A%09%09g.topologicalOrderTraversal(%0A%09%09%09new EarliestTimeVisitor(earliestTime));%0A%09%09int%5B%5D latestTime = new int%5Bn%5D;%0A%09%09latestTime%5Bn-1%5D = earliestTime%5Bn-1%5D;%0A%09%09g.depthFirstTraversal(new PostOrder (%0A%09%09%09new LatestTimeVisitor(latestTime)), 0);%0A%09%09digraph slackGraph = new digraphAsLists(n);%0A%09%09for(int v=0; v%3Cn; ++v)%0A%09%09%09slackGraph.addVertex(v);%0A%09%09Enumeration p = g.getEdges();%0A%09%09while(p.hasMoreElements()) %7B%0A%09%09%09Edge edge = (Edge) p.nextElement();%0A%09%09%09int n0 = edge.getV0().getNumber();%0A%09%09%09int n1 = edge.getV1().getNumber();%0A%09%09%09int wt = (Int) edge.getWeight();%0A%09%09%09int slack = latestTime%5Bn1%5D - earliestTime%5Bn0%5D - wt.intValue();%0A%09%09%09slackGraph.addEdge(n0, n1, new Int(slack));%0A%09%09%7D%0A%09%09return dijkstras(slackGraph, 0);%0A%09%7D%0A%7D%0A

add critical path