aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
index e6b582c..9ef75cf 100644
--- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
+++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
@@ -237,11 +237,12 @@ public final class Graph {
/// @return weight of final random path
private static int solution(final AbstractGraph g) {
List<Vertex> path = new ArrayList<>(g.vertices());
+
// order of list contents becomes path order
Collections.shuffle(path);
+
int cost = 0;
for (int i = 0; i < path.size() - 1; i++) {
- // get weight between next vertices in module group graph
cost += g.getWeight(path.get(i), path.get(i + 1));
}
return cost;
@@ -279,7 +280,7 @@ public final class Graph {
assertConnected(g);
System.out.println(
"\n\nGraph is connected"
- + " (otherwise an exception was thrown)");
+ + " (otherwise an exception was thrown)");
// collect disjoint choice sets
ArrayList<Set<Vertex>> s = disjoint(g);