Skip to content

Commit 53849b0

Browse files
committed
Fix wrong expected relType in algo test
It expected the same type as the baseGraph. Bug in the test
1 parent dfa6b81 commit 53849b0

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

algo/src/main/java/org/neo4j/gds/similarity/nodesim/TopKGraph.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public boolean hasRelationshipProperty() {
5959

6060
@Override
6161
public GraphSchema schema() {
62+
var type = RelationshipType.of("SIMILAR");
6263
var relationshipSchema = new MutableRelationshipSchema(
6364
Map.of(
64-
RelationshipType.ALL_RELATIONSHIPS,
65+
type,
6566
new MutableRelationshipSchemaEntry(
66-
RelationshipType.ALL_RELATIONSHIPS,
67+
type,
6768
Direction.DIRECTED,
6869
Map.of(
6970
"similarity",

algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,15 @@ void shouldComputeNegativeTopKForSupportedDirections(Orientation orientation, in
462462

463463
assertGraphEquals(
464464
orientation == REVERSE
465-
? fromGdl(" (i1:Item)-[:LIKES {w: 0.50000D}]->(i3:Item)" +
466-
", (i2:Item)-[:LIKES {w: 0.50000D}]->(i3)" +
467-
", (i3)-[:LIKES {w: 0.500000D}]->(i1)" +
465+
? fromGdl(" (i1:Item)-[:SIMILAR {w: 0.50000D}]->(i3:Item)" +
466+
", (i2:Item)-[:SIMILAR {w: 0.50000D}]->(i3)" +
467+
", (i3)-[:SIMILAR {w: 0.500000D}]->(i1)" +
468468
", (i4:Item)" +
469469
", (:Person), (:Person), (:Person), (:Person)")
470-
: fromGdl(" (a:Person)-[:LIKES {w: 0.333333D}]->(c:Person)" +
471-
", (b:Person)-[:LIKES {w: 0.00000D}]->(c)" +
472-
", (c)-[:LIKES {w: 0.000000D}]->(b)" +
473-
", (d:Person)-[:LIKES {w: 0.333333D}]->(c)" +
470+
: fromGdl(" (a:Person)-[:SIMILAR {w: 0.333333D}]->(c:Person)" +
471+
", (b:Person)-[:SIMILAR {w: 0.00000D}]->(c)" +
472+
", (c)-[:SIMILAR {w: 0.000000D}]->(b)" +
473+
", (d:Person)-[:SIMILAR {w: 0.333333D}]->(c)" +
474474
", (:Item), (:Item), (:Item), (:Item)"),
475475
similarityGraph
476476
);
@@ -636,26 +636,26 @@ void shouldComputeSimilarityGraphInAllSupportedDirections(Orientation orientatio
636636
orientation == REVERSE
637637
? fromGdl(" (:Person), (:Person), (:Person), (:Person)" +
638638
", (:Item)" +
639-
", (i1:Item)-[:LIKES {property: 1.000000D}]->(i2:Item)" +
640-
", (i1)-[:LIKES {property: 0.500000D}]->(i3:Item)" +
641-
", (i2)-[:LIKES {property: 0.500000D}]->(i3)" +
639+
", (i1:Item)-[:SIMILAR {property: 1.000000D}]->(i2:Item)" +
640+
", (i1)-[:SIMILAR {property: 0.500000D}]->(i3:Item)" +
641+
", (i2)-[:SIMILAR {property: 0.500000D}]->(i3)" +
642642
// Add results in reverse direction because topK
643-
", (i2)-[:LIKES {property: 1.000000D}]->(i1)" +
644-
", (i3)-[:LIKES {property: 0.500000D}]->(i1)" +
645-
", (i3)-[:LIKES {property: 0.500000D}]->(i2)")
646-
: fromGdl(" (p1:Person)-[:LIKES {property: 0.666667D}]->(p2:Person)" +
647-
", (p1)-[:LIKES {property: 0.333333D}]->(p3:Person)" +
648-
", (p1)-[:LIKES {property: 1.000000D}]->(p4:Person)" +
649-
", (p2)-[:LIKES {property: 0.000000D}]->(p3)" +
650-
", (p2)-[:LIKES {property: 0.666667D}]->(p4)" +
651-
", (p3)-[:LIKES {property: 0.333333D}]->(p4)" +
643+
", (i2)-[:SIMILAR {property: 1.000000D}]->(i1)" +
644+
", (i3)-[:SIMILAR {property: 0.500000D}]->(i1)" +
645+
", (i3)-[:SIMILAR {property: 0.500000D}]->(i2)")
646+
: fromGdl(" (p1:Person)-[:SIMILAR {property: 0.666667D}]->(p2:Person)" +
647+
", (p1)-[:SIMILAR {property: 0.333333D}]->(p3:Person)" +
648+
", (p1)-[:SIMILAR {property: 1.000000D}]->(p4:Person)" +
649+
", (p2)-[:SIMILAR {property: 0.000000D}]->(p3)" +
650+
", (p2)-[:SIMILAR {property: 0.666667D}]->(p4)" +
651+
", (p3)-[:SIMILAR {property: 0.333333D}]->(p4)" +
652652
// Add results in reverse direction because topK
653-
" (p2)-[:LIKES {property: 0.666667D}]->(p1)" +
654-
", (p3)-[:LIKES {property: 0.333333D}]->(p1)" +
655-
", (p4)-[:LIKES {property: 1.000000D}]->(p1)" +
656-
", (p3)-[:LIKES {property: 0.000000D}]->(p2)" +
657-
", (p4)-[:LIKES {property: 0.666667D}]->(p2)" +
658-
", (p4)-[:LIKES {property: 0.333333D}]->(p3)" +
653+
" (p2)-[:SIMILAR {property: 0.666667D}]->(p1)" +
654+
", (p3)-[:SIMILAR {property: 0.333333D}]->(p1)" +
655+
", (p4)-[:SIMILAR {property: 1.000000D}]->(p1)" +
656+
", (p3)-[:SIMILAR {property: 0.000000D}]->(p2)" +
657+
", (p4)-[:SIMILAR {property: 0.666667D}]->(p2)" +
658+
", (p4)-[:SIMILAR {property: 0.333333D}]->(p3)" +
659659
", (:Item), (:Item), (:Item), (:Item)"),
660660
resultGraph
661661
);

0 commit comments

Comments
 (0)