File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
algo-common/src/main/java/org/neo4j/graphalgo/result
proc/common/src/test/java/org/neo4j/graphalgo/result Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ private void buildCommunityCount() {
100
100
long communityCount = 0L ;
101
101
102
102
SparseNodeMapping componentSizes = buildComponentSizes ();
103
- for (int communityId = 0 ; communityId < componentSizes .getCapacity (); communityId ++) {
103
+ for (long communityId = 0 ; communityId < componentSizes .getCapacity (); communityId ++) {
104
104
long communitySize = componentSizes .get (communityId );
105
105
if (communitySize > 0 ) {
106
106
communityCount ++;
Original file line number Diff line number Diff line change @@ -176,6 +176,24 @@ void oneCommunityFromHugeMap() {
176
176
assertEquals (4.0 , histogram .getValueAtPercentile (100D ), 0.01 );
177
177
}
178
178
179
+ @ Test
180
+ void buildCommunityCountWithHugeCommunityCount () {
181
+ AbstractCommunityResultBuilder <Void > builder = builder (
182
+ procedureCallContext ("communityCount" ),
183
+ (maybeCommunityCount , maybeHistogram ) -> {
184
+ assertTrue (maybeCommunityCount .isPresent ());
185
+ assertFalse (maybeHistogram .isPresent ());
186
+ long communityCount = maybeCommunityCount .orElse (-1 );
187
+ assertEquals (2L , communityCount , "should build 2 communities" );
188
+ });
189
+
190
+ LongUnaryOperator communityFunction = n -> n % 2 == 0 ? 0 : ((long ) Integer .MAX_VALUE ) + 2 ;
191
+ builder
192
+ .withCommunityFunction (communityFunction )
193
+ .withNodeCount (2 )
194
+ .build ();
195
+ }
196
+
179
197
@ Test
180
198
void buildCommunityHistogramWithHugeCommunityCount () {
181
199
AbstractCommunityResultBuilder <Void > builder = builder (
You can’t perform that action at this time.
0 commit comments