Skip to content

Commit

Permalink
Fixed bug with Leiden algorithm always running with default parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
agudys authored Oct 5, 2024
1 parent 6ac12c7 commit 5503c50
Show file tree
Hide file tree
Showing 5 changed files with 8,472 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,8 @@ jobs:
run: |
./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
cmp ictv.${{matrix.algo}}.${{matrix.threshold}}.reps.num ./test/ictv.${{matrix.algo}}.${{matrix.threshold}}.reps.csv
- name: ${{matrix.algo}}, ${{matrix.threshold}} (non-default params)
run: |
./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
cmp ictv.${{matrix.algo}}-params.${{matrix.threshold}}.reps.csv ./test/ictv.${{matrix.algo}}-params.${{matrix.threshold}}.reps.csv
4 changes: 2 additions & 2 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ void Console::doClustering(
int n_clusters = 0;

if (needDistances(params.algo)) {
auto clustering = createClusteringAlgo<dist_t>(params.algo);
auto clustering = createClusteringAlgo<dist_t>(params);
IMatrix& mat = graph.getMatrix();
SparseMatrix<dist_t>& distances = static_cast<SparseMatrix<dist_t>&>(mat);
n_clusters = (*clustering)(distances, objects, threshold, assignments);
}
else {
auto clustering = createClusteringAlgo<mini_dist_t>(params.algo);
auto clustering = createClusteringAlgo<mini_dist_t>(params);
IMatrix& mat = graph.getMatrix();
SparseMatrix<mini_dist_t>& distances = static_cast<SparseMatrix<mini_dist_t>&>(mat);
n_clusters = (*clustering)(distances, objects, threshold, assignments);
Expand Down
4 changes: 2 additions & 2 deletions src/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ class Console {
}

template <class Distance>
std::unique_ptr<IClustering<Distance>> createClusteringAlgo(Algo algo) {
std::unique_ptr<IClustering<Distance>> createClusteringAlgo(const Params& params) {

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

switch (algo)
switch (params.algo)
{

case Algo::SingleLinkage:
Expand Down
7 changes: 5 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
//
// *******************************************************************************************

#define VERSION "1.1.0"
#define DATE "2024-09-30"
#define VERSION "1.1.1"
#define DATE "2024-10-05"


/********* Version history *********
1.1.1 (2024-10-05)
Fixed bug with Leiden algorithm always running with default parameters.
1.1.0 (2024-09-30)
Memory optimizatons:
* Row identifier removed from dist_t structure.
Expand Down
Loading

0 comments on commit 5503c50

Please sign in to comment.