aboutsummaryrefslogtreecommitdiff
path: root/src/dk.biks.bachelorizer/dk/biks
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-04-30 23:16:59 +0200
committerJonas Smedegaard <dr@jones.dk>2025-04-30 23:16:59 +0200
commit9c65ff132c7026be1ecf8d9ef932b6553ecffa07 (patch)
tree1efb095de8d854268237500779df506f7aee7aed /src/dk.biks.bachelorizer/dk/biks
parentfc937e3eafe20daf65c4e6784a9e7fd038a1b8c4 (diff)
avoid too long lines
Diffstat (limited to 'src/dk.biks.bachelorizer/dk/biks')
-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);