Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AcyclicGraphWithEdgeWeightsFixture |
|
| 1.0;1 |
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.test.graph.alg.spath; | |
23 | ||
24 | ||
25 | /** | |
26 | * @author schickin | |
27 | * | |
28 | */ | |
29 | public class AcyclicGraphWithEdgeWeightsFixture | |
30 | extends AbstractGraphWithShortestPathFixture { | |
31 | ||
32 | // graph taken from "Network Flows", Ahuja/Magnanti/Orlin, p. 110 | |
33 | // | |
34 | // 2 | |
35 | // ----> 2 -----> 4 ----- | |
36 | // | ^\ | | | |
37 | // 4 | | \ | | 3 | |
38 | // | | \ 1 | * | |
39 | // 0 2 | \ | 5 | |
40 | // | | 1 \ | ^ | |
41 | // 6 | | \ | | | |
42 | // | | * * | 7 | |
43 | // ----> 1 -----> 3 ----- | |
44 | // 2 | |
45 | // | |
46 | // The shortest path from 1 to 3 is: (1, 3, 5, 6) with length 4+2+3=9 | |
47 | // | |
48 | 3 | private static int[][] edgesWithWeights = { |
49 | {0, 2, 4}, | |
50 | {0, 1, 6}, | |
51 | {1, 2, 2}, | |
52 | {1, 3, 2}, | |
53 | {2, 3, 1}, | |
54 | {2, 4, 2}, | |
55 | {3, 5, 7}, | |
56 | {4, 3, 1}, | |
57 | {4, 5, 3} | |
58 | }; | |
59 | ||
60 | 3 | private static int[] predNum = {0, 0, 0, 2, 2, 4}; |
61 | 3 | private static int[] distanceToNode = {0, 6, 4, 5, 6, 9}; |
62 | 3 | private static int[] spath = {0, 2, 4, 5}; |
63 | ||
64 | /** | |
65 | * constructor | |
66 | */ | |
67 | public AcyclicGraphWithEdgeWeightsFixture() throws Exception { | |
68 | 21 | super(edgesWithWeights, predNum, distanceToNode, spath); |
69 | 21 | } |
70 | } |