Net creation #2

Merged
Berack96 merged 21 commits from net-creation into main 2025-03-16 18:02:38 +01:00
Showing only changes of commit 65e8f378f5 - Show all commits

View File

@@ -170,14 +170,13 @@ public final class Net implements Iterable<ServerNode> {
for (var conn : list) for (var conn : list)
sum += conn.weight; sum += conn.weight;
var newOne = new Connection[list.size()]; var newOne = new ArrayList<Connection>();
for (var i = 0; i < list.size(); i++) { for (var conn : list) {
var conn = list.get(i);
var newWeight = conn.weight / sum; var newWeight = conn.weight / sum;
newOne[i] = new Connection(conn.index, newWeight); newOne.add(new Connection(conn.index, newWeight));
} }
this.connections.set(node, List.of(newOne)); this.connections.set(node, newOne);
} }
} }