From 9c65ff132c7026be1ecf8d9ef932b6553ecffa07 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 30 Apr 2025 23:16:59 +0200 Subject: avoid too long lines --- src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java | 5 +++-- 1 file 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 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> s = disjoint(g); -- cgit v1.2.3