Skip to content

Commit 098f864

Browse files
authored
Merge pull request #1424 from jjaderberg/is-multi-graph-fix
Fix isMultiGraph check in two places
2 parents 1efb04b + 2ae4f40 commit 098f864

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

core/src/main/java/org/neo4j/graphalgo/core/loading/HugeGraphUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public HugeGraph.Relationships build() {
248248
return HugeGraph.Relationships.of(
249249
importedRelationships,
250250
orientation,
251-
!Aggregation.equivalentToNone(aggregation),
251+
Aggregation.equivalentToNone(aggregation),
252252
relationshipsBuilder.adjacencyList(),
253253
relationshipsBuilder.globalAdjacencyOffsets(),
254254
loadRelationshipProperty ? relationshipsBuilder.properties() : null,

proc/common/src/main/java/org/neo4j/graphalgo/AlgoBaseProc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ protected void warnOnGraphWithParallelRelationships(GraphCreateConfig graphCreat
356356
storeConfig.relationshipProjections().projections().entrySet().stream()
357357
.filter(entry -> config.relationshipTypes().equals(Collections.singletonList(PROJECT_ALL)) ||
358358
config.relationshipTypes().contains(entry.getKey().name()))
359-
.filter(entry -> !entry.getValue().isMultiGraph())
359+
.filter(entry -> entry.getValue().isMultiGraph())
360360
.forEach(entry -> log.warn(
361361
"Procedure runs optimal with relationship aggregation." +
362362
" Projection for `%s` does not aggregate relationships." +

proc/community/src/test/java/org/neo4j/graphalgo/triangle/LocalClusteringCoefficientBaseProcTest.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.lang.reflect.InvocationTargetException;
4040
import java.util.Map;
4141

42+
import static org.junit.jupiter.api.Assertions.assertEquals;
4243
import static org.junit.jupiter.api.Assertions.fail;
4344
import static org.neo4j.graphalgo.config.GraphCreateFromCypherConfig.ALL_RELATIONSHIPS_UNDIRECTED_QUERY;
4445
import static org.neo4j.graphalgo.config.GraphCreateFromStoreConfig.RELATIONSHIP_PROJECTION_KEY;
@@ -148,7 +149,14 @@ public String seedPropertyKeyOverride() {
148149
@Test
149150
void warnOnNoneAggregatedGraph() {
150151
var graphName = "nonagg";
151-
runQuery("CALL gds.graph.create($graphName, '*', '*')", Map.of("graphName", graphName));
152+
runQuery("CALL gds.graph.create(" +
153+
" $graphName," +
154+
" '*', {" +
155+
" ALL: {" +
156+
" type: '*'," +
157+
" orientation: 'UNDIRECTED'" +
158+
" }" +
159+
" })", Map.of("graphName", graphName));
152160

153161
CypherMapWrapper config = createMinimalConfig(CypherMapWrapper.empty());
154162

@@ -160,18 +168,17 @@ void warnOnNoneAggregatedGraph() {
160168
.filter(procMethod -> !getProcedureMethodName(procMethod).endsWith(".estimate"))
161169
.forEach(noneEstimateMethod -> {
162170
try {
163-
noneEstimateMethod.invoke(proc, "g", config.toMap());
171+
noneEstimateMethod.invoke(proc, "nonagg", config.toMap());
164172
} catch (IllegalAccessException | InvocationTargetException e) {
165173
fail(e);
166174
}
167175
});
168176
});
169177

170-
testLog.containsMessage(
171-
"warn",
172-
"Procedure runs optimal with relationship aggregation. " +
173-
"Projection for `*` does not aggregate relationships. " +
174-
"You might experience a slowdown in the procedure execution."
175-
);
178+
String expected = "Procedure runs optimal with relationship aggregation. " +
179+
"Projection for `ALL` does not aggregate relationships. " +
180+
"You might experience a slowdown in the procedure execution.";
181+
String actual = testLog.getMessages("warn").get(0);
182+
assertEquals(expected, actual);
176183
}
177184
}

test-utils/src/main/java/org/neo4j/graphalgo/TestGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public boolean isUndirected() {
104104

105105
@Override
106106
public boolean isMultiGraph() {
107-
return false;
107+
return true;
108108
}
109109

110110
@Override

0 commit comments

Comments
 (0)