Weakly Connected Components

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

direction

-

concurrency

concurrency

readConcurrency

readConcurrency [1]

writeConcurrency

writeConcurrency [2]

writeProperty

writeProperty [2]

weightProperty

relationshipWeightProperty

defaultValue

defaultValue

seedProperty

seedProperty

threshold

threshold

consecutiveIds

consecutiveIds

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

nodeId

nodeId [3]

setId

componentId [3]

nodes

nodePropertiesWritten [4]

-

relationshipPropertiesWritten [4]

write

-

-

componentDistribution

-

configuration [5]

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 componentDistribution

Table 3. Weakly Connected Components Stream Mode
Graph Algorithms v3.5 Graph Data Science v1.0

Minimalistic stream over named graph:

CALL algo.unionFind.stream(null, null, {graph: 'myGraph'})
YIELD nodeId, setId
CALL gds.wcc.stream('myGraph')
YIELD nodeId, componentId

Streaming over weighted named graph:

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

Minimalistic streaming over anonymous graph:

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

Streaming over anonymous graph with REVERSE relationship orientation:

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

Streaming over anonymous graph with relationship specifying default value for the weight property:

CALL algo.unionFind.stream(
  'MyLabel',
  'MY_RELATIONSHIP_TYPE',
  {
    graph: 'myGraph',
    weightProperty: 'myWeightProperty',
    defaultValue: 2.0
  }
)
CALL gds.wcc.stream({
  nodeProjection: 'MyLabel',
  relationshipProjection: {
    MY_RELATIONSHIP_TYPE: {
      properties: {
        myWeightProperty: {
          defaultValue: 2
        }
      }
    }
  }
})
Table 4. Weakly Connected Components Write Mode
Graph Algorithms v3.5 Graph Data Science v1.0

Minimalistic write mode:

CALL algo.unionFind(
  null,
  null,
  {
    graph: 'myGraph',
    writeProperty: 'myWriteProperty',
    write: true
  }
)
YIELD
  nodes,
  loadMillis,
  p1,
  writeProperty
CALL gds.wcc.write(
  'myGraph',
  { writeProperty: 'myWriteProperty' }
)
YIELD
  nodePropertiesWritten,
  createMillis,
  componentDistribution AS cd,
  configuration AS conf
RETURN
  nodePropertiesWritten,
  createMillis,
  cd.p1 AS p1,
  conf.writeProperty AS writeProperty

Running write mode over weighted named graph:

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

Memory estimation of the algorithm:

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