Skip to content

Commit

Permalink
migrate estimation cli leiden to application layer
Browse files Browse the repository at this point in the history
  • Loading branch information
lassewesth committed Dec 3, 2024
1 parent baeff69 commit caf819e
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 376 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
package org.neo4j.gds.leiden;

import org.junit.jupiter.api.Test;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.applications.algorithms.community.CommunityAlgorithms;
import org.neo4j.gds.applications.algorithms.community.LeidenTask;
import org.neo4j.gds.core.utils.progress.tasks.Tasks;
import org.neo4j.gds.gdl.GdlFactory;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

class LeidenAlgorithmFactoryTest {

Expand All @@ -38,8 +39,7 @@ void shouldProduceProgressTask() {

var graph = GdlFactory.of(" CREATE (a:NODE), (b:NODE) ").build().getUnion();

var task = new LeidenAlgorithmFactory<>().progressTask(graph, config);

var task = LeidenTask.create(graph, config);
var initialization = Tasks.leaf("Initialization", 2);

var iteration = Tasks.iterativeDynamic("Iteration", () ->
Expand All @@ -59,13 +59,11 @@ void shouldProduceProgressTask() {
@Test
void shouldThrowIfNotUndirected() {
var graph = GdlFactory.of("(a)-->(b)").build().getUnion();
var config = LeidenStatsConfigImpl.builder().maxLevels(3).build();
var leidenFactory = new LeidenAlgorithmFactory<>();
assertThatThrownBy(() -> leidenFactory.build(
graph,
config,
ProgressTracker.NULL_TRACKER
)).hasMessageContaining(
"undirected");

var communityAlgorithms = new CommunityAlgorithms(null, null);

assertThatIllegalArgumentException()
.isThrownBy(() -> communityAlgorithms.leiden(graph, null))
.withMessage("The Leiden algorithm works only with undirected graphs. Please orient the edges properly");
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit caf819e

Please sign in to comment.