| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SingleSourceShortestPathAlg |
|
| 0.0;0 |
| 1 | /* | |
| 2 | This file is part of Combean. | |
| 3 | ||
| 4 | Combean is free software; you can redistribute it and/or modify | |
| 5 | it under the terms of the GNU General Public License as published by | |
| 6 | the Free Software Foundation; either version 2 of the License, or | |
| 7 | (at your option) any later version. | |
| 8 | ||
| 9 | Combean is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | GNU General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU General Public License | |
| 15 | along with Combean; if not, write to the Free Software | |
| 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | */ | |
| 18 | /* | |
| 19 | * Created on 09.04.2005 | |
| 20 | * | |
| 21 | */ | |
| 22 | package net.sourceforge.combean.interfaces.graph.alg.spath; | |
| 23 | ||
| 24 | import net.sourceforge.combean.interfaces.graph.Edge; | |
| 25 | import net.sourceforge.combean.interfaces.graph.Node; | |
| 26 | import net.sourceforge.combean.interfaces.graph.containers.FixedPath; | |
| 27 | import net.sourceforge.combean.interfaces.graph.containers.NodeMap; | |
| 28 | ||
| 29 | /** | |
| 30 | * Interface for single source shortest path algorithms. | |
| 31 | * | |
| 32 | * @author schickin | |
| 33 | * | |
| 34 | */ | |
| 35 | public interface SingleSourceShortestPathAlg | |
| 36 | <NumType extends Comparable<NumType>> | |
| 37 | extends ShortestPathAlg<NumType> { | |
| 38 | ||
| 39 | /** | |
| 40 | * Define the source of the shortest paths. | |
| 41 | * | |
| 42 | * @param s | |
| 43 | */ | |
| 44 | void setSource(Node s); | |
| 45 | ||
| 46 | /** | |
| 47 | * Return the shortest path to a given node (may only be called after | |
| 48 | * the algorithm has been run) | |
| 49 | * | |
| 50 | * @param t the node to which the shortest path shall be given | |
| 51 | * @return the shortest path to t | |
| 52 | */ | |
| 53 | FixedPath getShortestPathTo(Node t); | |
| 54 | ||
| 55 | /** | |
| 56 | * Return the shortest path distance to a given node (may only be | |
| 57 | * called after the algorithm has been run). | |
| 58 | * | |
| 59 | * @param t the node to which the shortest path distance shall be given. | |
| 60 | * @return the length of the shortest path to t. | |
| 61 | */ | |
| 62 | NumType getDistanceTo(Node t); | |
| 63 | ||
| 64 | /** | |
| 65 | * Return a NodeMap which maps every node in the graph to its predecessor | |
| 66 | * (or null if no precedessor exists, e.g. for the source or because | |
| 67 | * the node has not been reached by the shortest path algorithm). | |
| 68 | * | |
| 69 | * @return the predecessor map | |
| 70 | */ | |
| 71 | NodeMap<Edge> getPredecessorMap(); | |
| 72 | ||
| 73 | /** | |
| 74 | * Return a NodeMap which contains the shortest distance to the source | |
| 75 | * for every node (or infinity if the node is not reachable from the | |
| 76 | * source). | |
| 77 | * The elements must be of type Comparable. The exact type depends on the | |
| 78 | * subclass of Comparable which is used by the PathAlgebra. | |
| 79 | * | |
| 80 | * @return the map of shortest distances to the source. | |
| 81 | */ | |
| 82 | NodeMap getDistanceMap(); | |
| 83 | ||
| 84 | } |