Louvain

Table 1. Changes in Configuration
Graph Algorithms v3.5 Graph Data Science v1.0

direction

-

levels

maxLevels

concurrency

concurrency

readConcurrency

readConcurrency [1]

writeConcurrency

writeConcurrency [2]

weightProperty

relationshipWeightProperty

seedProperty

seedProperty

innerIterations

maxIterations

includeIntermediateCommunities

includeIntermediateCommunities

tolerance

tolerance

writeProperty

writeProperty [2]

write

-

graph

-

1. Only when using anonymous graph

2. Only for write mode

Table 2. Changes in YIELD fields
Graph Algorithms v3.5 Graph Data Science v1.0

loadMillis

createMillis

computeMillis

computeMillis

writeMillis

writeMillis

postProcessingMillis

postProcessingMillis

nodes

nodePropertiesWritten

communityCount

communityCount

levels

ranLevels

nodeId

nodeId [3]

community

communityId [3]

communities

intermediateCommunityIds [3]

modularity

modularity [4]

modularities

modularities [4]

write

-

-

communityDistribution

-

configuration [5]

includeIntermediateCommunities [6]

-

writeProperty [6]

-

weightProperty [7]

-

min, max, mean, p50, p75, p90, p95, p99, p999 [8]

-

3. Only for stream mode

4. Only for write mode

5. The configuration used to run the algorithm

6. Inlined into configuration

7. Inlined into configuration as relationshipWeightProperty

8. Inlined into communityDistribution

Table 3. Louvain Stream Mode
Graph Algorithms v3.5 Graph Data Science v1.0

Minimalistic streaming over named graph:

CALL algo.beta.louvain.stream(null, null, {graph: 'myGraph'})
YIELD nodeId, community, communities
CALL gds.louvain.stream('myGraph')
YIELD nodeId, communityId, intermediateCommunityIds

Streaming over named graph using additional properties - maxLevels and maxIterations:

CALL algo.beta.louvain.stream(
  null,
  null,
  {
    graph: 'myGraph',
    levels: 15,
    innerIterations: 30
  }
)
CALL gds.louvain.stream(
  'myGraph',
  {
    maxLevels: 15,
    maxIterations: 30
  }
)

Streaming over named graph with weight property:

CALL algo.beta.louvain.stream(
  null,
  null,
  {
    graph: 'myGraph',
    weightProperty: 'myWeightProperty'
  }
)
CALL gds.louvain.stream(
  'myGraph',
  {
    relationshipWeightProperty: 'myWeightProperty'
  }
)

Minimalistic streaming over anonymous graph:

CALL algo.beta.louvain.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE'
)
CALL gds.louvain.stream({
  nodeProjection: 'MyLabel',
  relationshipProjection: 'MY_RELATIONSHIP_TYPE'
})

Streaming over anonymous graph with REVERSE relationship orientation:

CALL algo.beta.louvain.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  { direction: 'INCOMING' }
)
CALL gds.louvain.stream({
  nodeProjection: 'MyLabel',
  relationshipProjection: {
    MY_RELATIONSHIP_TYPE: {
      orientation: 'REVERSE'
    }
  }
})

Streaming over anonymous graph using two way relationships [1]:


1. Not algorithm specific. This is also possible with named graphs. The graph has to be created with two relationship projections - one for each direction
CALL algo.louvain.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  { direction: 'BOTH' }
)
CALL gds.louvain.stream({
  nodeProjection: 'MyLabel',
  relationshipProjection: {
    MY_RELATIONSHIP_TYPE_NATURAL: {
      type: 'MY_RELATIONSHIP_TYPE',
      orientation: 'NATURAL'
    },
    MY_RELATIONSHIP_TYPE_REVERSE: {
      type: 'MY_RELATIONSHIP_TYPE',
      orientation: 'REVERSE'
    }
  }
})

9. Not algorithm specific. This is also possible with named graphs. The graph has to be created with two relationship projections - one for each direction

Table 4. Louvain Write Mode
Graph Algorithms v3.5 Graph Data Science v1.0

Minimalistic write with just writeProperty:

CALL algo.beta.louvain(
  null,
  null,
  {
    graph: 'myGraph',
    writeProperty: 'myWriteProperty',
    write: true
  }
)
YIELD
  nodes,
  writeMillis,
  levels,
  iterations,
  p1,
  writeProperty
CALL gds.louvain.write(
  'myGraph',
  { writeProperty: 'myWriteProperty' }
)
YIELD
  nodePropertiesWritten,
  writeMillis,
  ranLevels,
  ranIterations,
  communityDistribution AS cd,
  configuration AS conf
RETURN
  nodePropertiesWritten,
  writeMillis,
  ranLevels,
  ranIterations,
  cd.p1 AS p1,
  conf.writeProperty AS writeProperty

Running in write mode over weighted graph:

CALL algo.beta.louvain(
  null,
  null,
  {
    graph: 'myGraph',
    writeProperty: 'myWriteProperty',
    weightProperty: 'myWeightProperty',
    write: true
  }
)
CALL gds.louvain.write(
  'myGraph',
  {
    writeProperty: 'myWriteProperty',
    relationshipWeightProperty: 'myWeightProperty'
  }
)

Memory estimation of the algorithm:

CALL algo.memrec(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  'beta.louvain',
  {
    writeProperty: 'myWriteProperty',
    weightProperty: 'myRelationshipWeightProperty',
    write: true
  }
)
CALL gds.louvain.write.estimate(
  {
    nodeProjection: 'MyLabel',
    relationshipProjection: 'MY_RELATIONSHIP_TYPE',
    writeProperty: 'myWriteProperty',
    relationshipWeightProperty: 'myWeightProperty'
  }
)