Skip to content

Commit 5503c50

Browse files
authored
Fixed bug with Leiden algorithm always running with default parameters.
1 parent 6ac12c7 commit 5503c50

File tree

5 files changed

+8472
-7
lines changed

5 files changed

+8472
-7
lines changed

.github/workflows/self-hosted.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,8 @@ jobs:
239239
run: |
240240
./clusty-leiden-${{matrix.compiler}} --algo ${{matrix.algo}} --objects-file ./test/ictv.list --similarity --min ani 0.${{matrix.threshold}} ./test/ictv.num ictv.${{matrix.algo}}.${{matrix.threshold}}.reps.num --out-representatives --numeric-ids
241241
cmp ictv.${{matrix.algo}}.${{matrix.threshold}}.reps.num ./test/ictv.${{matrix.algo}}.${{matrix.threshold}}.reps.csv
242-
242+
243+
- name: ${{matrix.algo}}, ${{matrix.threshold}} (non-default params)
244+
run: |
245+
./clusty-leiden-${{matrix.compiler}} --algo ${{matrix.algo}} --objects-file ./test/ictv.list --similarity --min ani 0.${{matrix.threshold}} --leiden-resolution 1.0 --leiden-beta 0.03 --leiden-iterations 3 ./test/ictv.ani ictv.${{matrix.algo}}-params.${{matrix.threshold}}.reps.csv --out-representatives
246+
cmp ictv.${{matrix.algo}}-params.${{matrix.threshold}}.reps.csv ./test/ictv.${{matrix.algo}}-params.${{matrix.threshold}}.reps.csv

src/console.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ void Console::doClustering(
166166
int n_clusters = 0;
167167

168168
if (needDistances(params.algo)) {
169-
auto clustering = createClusteringAlgo<dist_t>(params.algo);
169+
auto clustering = createClusteringAlgo<dist_t>(params);
170170
IMatrix& mat = graph.getMatrix();
171171
SparseMatrix<dist_t>& distances = static_cast<SparseMatrix<dist_t>&>(mat);
172172
n_clusters = (*clustering)(distances, objects, threshold, assignments);
173173
}
174174
else {
175-
auto clustering = createClusteringAlgo<mini_dist_t>(params.algo);
175+
auto clustering = createClusteringAlgo<mini_dist_t>(params);
176176
IMatrix& mat = graph.getMatrix();
177177
SparseMatrix<mini_dist_t>& distances = static_cast<SparseMatrix<mini_dist_t>&>(mat);
178178
n_clusters = (*clustering)(distances, objects, threshold, assignments);

src/console.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ class Console {
5353
}
5454

5555
template <class Distance>
56-
std::unique_ptr<IClustering<Distance>> createClusteringAlgo(Algo algo) {
56+
std::unique_ptr<IClustering<Distance>> createClusteringAlgo(const Params& params) {
5757

5858
std::unique_ptr<IClustering<Distance>> clustering;
5959

60-
switch (algo)
60+
switch (params.algo)
6161
{
6262

6363
case Algo::SingleLinkage:

src/version.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
//
99
// *******************************************************************************************
1010

11-
#define VERSION "1.1.0"
12-
#define DATE "2024-09-30"
11+
#define VERSION "1.1.1"
12+
#define DATE "2024-10-05"
1313

1414

1515
/********* Version history *********
1616
17+
1.1.1 (2024-10-05)
18+
Fixed bug with Leiden algorithm always running with default parameters.
19+
1720
1.1.0 (2024-09-30)
1821
Memory optimizatons:
1922
* Row identifier removed from dist_t structure.

0 commit comments

Comments
 (0)