diff options
Diffstat (limited to 'src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java')
-rw-r--r-- | src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java index ec4a35d..78ade2a 100644 --- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java +++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java @@ -223,13 +223,19 @@ public final class Graph { AbstractGraph h = new AdjListGraph(); Map<Set<Vertex>, String> groupLabel = new HashMap<>(); for (Set<Vertex> groupSet : sets) { - // create a string for each group of module selections + + // stringify each group of module selections String name = groupSet.stream() .map(Vertex::toString) - .sorted() // avoid differently sorted duplicates - .collect(Collectors.joining(", ", "{", "}")); + + // avoid differently sorted duplicates + .sorted() + // formatting of groups as vertices - groupLabel.put(groupSet, name); // map group to name of group + .collect(Collectors.joining(", ", "{", "}")); + + // map group to name of group + groupLabel.put(groupSet, name); } for (Set<Vertex> s: sets) { @@ -237,9 +243,13 @@ public final class Graph { if (t == s) { continue; } + + // process each pair only once if (s.hashCode() > t.hashCode()) { - continue; // process each pair no more than once + continue; } + + // accumulate student count across set int sum = 0; for (Vertex v: s) { // students with this choice |