| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PathAlgebra |
|
| 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 10.04.2005 | |
| 20 | * | |
| 21 | */ | |
| 22 | package net.sourceforge.combean.interfaces.graph.alg.spath; | |
| 23 | ||
| 24 | /** | |
| 25 | * This interface contains the operations which are needed to calculate the | |
| 26 | * weights of paths in graphs. | |
| 27 | * | |
| 28 | * Usually, this will involve summing the numeric weights of individual edges | |
| 29 | * and taking the minimum over all possible paths to a node, but different | |
| 30 | * usages are supported. | |
| 31 | * | |
| 32 | * @author schickin | |
| 33 | * | |
| 34 | */ | |
| 35 | public interface PathAlgebra<NumType extends Comparable<NumType>> { | |
| 36 | ||
| 37 | /** | |
| 38 | * Add the length of to paths, yielding the length of the combined path | |
| 39 | * | |
| 40 | * @param pathLenOne | |
| 41 | * @param pathLenTwo | |
| 42 | * @return the length of the concatenation of the two paths (which are | |
| 43 | * assumed to be node disjoint. | |
| 44 | */ | |
| 45 | public NumType add(NumType pathLenOne, NumType pathLenTwo); | |
| 46 | ||
| 47 | /** | |
| 48 | * Calculate the minimum distance of a node. | |
| 49 | * | |
| 50 | * Assume that two paths lead to the same node. This function calculates | |
| 51 | * distance of this node to the source (usually taking the minimum of | |
| 52 | * the two values but different functions might be considered for certain | |
| 53 | * applications). | |
| 54 | * | |
| 55 | * @param pathLenOne | |
| 56 | * @param pathLenTwo | |
| 57 | * @return the 'minimum' length of the two paths | |
| 58 | */ | |
| 59 | public NumType min(NumType pathLenOne, NumType pathLenTwo); | |
| 60 | ||
| 61 | /** | |
| 62 | * Return a value 'infinity' which must be the neutral element of the | |
| 63 | * operation min. | |
| 64 | * | |
| 65 | * @return the length of an 'infinite' path. | |
| 66 | */ | |
| 67 | public NumType infinitePathLen(); | |
| 68 | ||
| 69 | /** | |
| 70 | * Return a value 'zero' which must be the neutral element of the operation | |
| 71 | * max and is equal to the length of an empty path. | |
| 72 | * | |
| 73 | * @return the length of an empty path. | |
| 74 | */ | |
| 75 | public NumType emptyPathLen(); | |
| 76 | } |