Skip to content

Commit b312d95

Browse files
authored
Validate edge weights in Graclus clustering
Added validation to check for negative edge weights in Graclus clustering.
1 parent 6dabb04 commit b312d95

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

torch_cluster/graclus.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def graclus_cluster(
5151
row, col = row[perm], col[perm]
5252

5353
if weight is not None:
54+
if (weight < 0).any().item():
55+
raise ValueError(f"PyG's implementation of Graclus clustering "
56+
f"does not support negative edge weights.")
5457
weight = weight[perm]
5558

5659
deg = row.new_zeros(num_nodes)

0 commit comments

Comments
 (0)