# Coverage details for edu.uci.ics.jung.algorithms.shortestpath.ShortestPathUtils

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Created on Jul 10, 2005`
3 |  | `*`
4 |  | `* Copyright (c) 2005, the JUNG Project and the Regents of the University`
5 |  | `* of California`
6 |  | `* All rights reserved.`
7 |  | `*`
8 |  | `* This software is open-source under the BSD license; see either`
9 |  | `* "license.txt" or`
10 |  | `* http://jung.sourceforge.net/license.txt for a description.`
11 |  | `*/`
12 |  | `package edu.uci.ics.jung.algorithms.shortestpath;`
13 |  | ``
14 |  | `import java.util.LinkedList;`
15 |  | `import java.util.List;`
16 |  | `import java.util.Map;`
17 |  | ``
18 |  | `import edu.uci.ics.jung.graph.Edge;`
19 |  | `import edu.uci.ics.jung.graph.Vertex;`
20 |  | ``
21 | 0 | `public class ShortestPathUtils`
22 |  | `{`
23 |  | `/**`
24 |  | `* Returns a <code>List</code> of the edges on the shortest path from`
25 |  | `* <code>source</code> to <code>target</code>, in order of their`
26 |  | `* occurrence on this path.`
27 |  | `*/`
28 |  | `public static List getPath(ShortestPath sp, Vertex source, Vertex target)`
29 |  | `{`
30 | 0 | `LinkedList path = new LinkedList();`
31 |  | ``
32 | 0 | `Map incomingEdges = sp.getIncomingEdgeMap(source);`
33 |  | ``
34 | 0 | `if (incomingEdges.isEmpty() || incomingEdges.get(target) == null)`
35 | 0 | `return path;`
36 | 0 | `Vertex current = target;`
37 | 0 | `while (current != source)`
38 |  | `{`
39 | 0 | `Edge incoming = (Edge)incomingEdges.get(current);`
40 | 0 | `path.addFirst(incoming);`
41 | 0 | `current = incoming.getOpposite(current);`
42 |  | `}`
43 | 0 | `return path;`
44 |  | `}`
45 |  | `}`

this report was generated by version 1.0.5 of jcoverage. visit www.jcoverage.com for updates. | copyright © 2003, jcoverage ltd. all rights reserved. Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.