Label Propagation

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

direction

-

iterations

maxIterations

concurrency

concurrency

readConcurrency

readConcurrency [1]

writeConcurrency

writeConcurrency [2]

weightProperty [3]

-

-

nodeWeightProperty

-

relationshipWeightProperty

seedProperty

seedProperty

partitionProperty

-

writeProperty

writeProperty [2]

write

-

graph

-

1. Only when using anonymous graph

2. Only for write mode

3. Can be configured separately by using nodeWeightProperty and relationshipWeightProperty

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

didConverge

didConverge

-

ranIterations

write

-

-

communityDistribution

-

configuration [4]

writeProperty [5]

-

weightProperty [6]

-

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

-

4. The configuration used to run the algorithm

5. Inlined into configuration

6. Inlined into configuration as nodeWeightProperty and/or relationshipWeightProperty

7. Inlined into communityDistribution

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

Streaming over a named graph:

CALL algo.labelPropagation.stream(null, null, {graph: 'myGraph'})
YIELD nodeId, label
CALL gds.labelPropagation.stream('myGraph')
YIELD nodeId, communityId

Streaming over a named graph using configuration for iterations and relationship weight property:

CALL algo.labelPropagation.stream(
  null,
  null,
  {
    graph: 'myGraph',
    iterations: 15,
    weightProperty: 'myWeightProperty'
  }
)
CALL gds.labelPropagation.stream(
  'myGraph',
  {
    maxIterations: 15,
    relationshipWeightProperty: 'myWeightProperty'
  }
)

Streaming over anonymous graph:

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

Streaming over anonymous graph using relationship with REVERSE orientation:

CALL algo.labelPropagation.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  { direction: 'INCOMING' }
)
CALL gds.labelPropagation.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.labelPropagation.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  { direction: 'BOTH' }
)
CALL gds.labelPropagation.stream({
  nodeProjection: 'MyLabel',
  relationshipProjection: {
    MY_RELATIONSHIP_TYPE_NATURAL: {
      type: 'MY_RELATIONSHIP_TYPE',
      orientation: 'NATURAL'
    },
    MY_RELATIONSHIP_TYPE_REVERSE: {
      type: 'MY_RELATIONSHIP_TYPE',
      orientation: 'REVERSE'
    }
  }
})

8. 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. Label Propagation Write Mode
Graph Algorithms v3.5 Graph Data Science v1.0

Minimalistic write:

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

Write using weight properties [2]:


2. In GA the weightProperty is for Nodes and Relationships while in GDS there are separate properties
CALL algo.labelPropagation(
  null,
  null,
  {
    graph: 'myGraph',
    writeProperty: 'myWriteProperty',
    weightProperty: 'myRelationshipWeightProperty',
    write: true
  }
)
CALL gds.labelPropagation.write(
  'myGraph',
  {
    writeProperty: 'myWriteProperty',
    relationshipWeightProperty: 'myRelationshipWeightProperty',
    nodeWeightProperty: 'myNodeWeightProperty'
  }
)

Memory estimation of the algorithm:

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

9. In GA the weightProperty is for Nodes and Relationships while in GDS there are separate properties