aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Valentin Christensen <valentianchristensen@gmail.com>2025-04-29 11:52:36 +0200
committerIan Valentin Christensen <valentianchristensen@gmail.com>2025-04-29 11:52:52 +0200
commitede9aee40921ad74602556410b3e60607d414ef0 (patch)
treeca53de030ffe4e88cf3d42d769edb2b104dd761e /src
parent2f623fff0b88668bfbe9c38710830c0a72dac621 (diff)
fix implementation of disjoint
Diffstat (limited to 'src')
-rw-r--r--src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
index 736d260..dee3c23 100644
--- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
+++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java
@@ -180,10 +180,18 @@ public final class Graph {
// iterate over subject modules
for (Vertex current : vip) {
- if (done.contains(current)) {
- continue;
- }
+ if (done.contains(current)) continue;
+
+ Set<Vertex> isolated = new HashSet<>();
+ isolated.add(current);
+ for (Vertex compared : vip) {
+ if (done.contains(compared) || compared.equals(current)) continue; // nested extra check
+
+ boolean fits = isolated.stream().allMatch(u -> g.getWeight(u,compared) == null);
+ if (fits) {isolated.add(compared);}
+ }
+/*
// add set of current and any unconnected modules
// TODO: try tighten to include current in loop
Set<Vertex> isolated = all_set.stream()
@@ -196,7 +204,7 @@ public final class Graph {
&& !done.contains(x);
}).collect(Collectors.toSet());
isolated.add(current);
-
+*/
// add as set and omit from future iterations
sets.add(isolated);
done.addAll(isolated);