Articulation Points
Glossary
- Directed
-
Directed trait. The algorithm is well-defined on a directed graph.
- Directed
-
Directed trait. The algorithm ignores the direction of the graph.
- Directed
-
Directed trait. The algorithm does not run on a directed graph.
- Undirected
-
Undirected trait. The algorithm is well-defined on an undirected graph.
- Undirected
-
Undirected trait. The algorithm ignores the undirectedness of the graph.
- Heterogeneous nodes
-
Heterogeneous nodes fully supported. The algorithm has the ability to distinguish between nodes of different types.
- Heterogeneous nodes
-
Heterogeneous nodes allowed. The algorithm treats all selected nodes similarly regardless of their label.
- Heterogeneous relationships
-
Heterogeneous relationships fully supported. The algorithm has the ability to distinguish between relationships of different types.
- Heterogeneous relationships
-
Heterogeneous relationships allowed. The algorithm treats all selected relationships similarly regardless of their type.
- Weighted relationships
-
Weighted trait. The algorithm supports a relationship property to be used as weight, specified via the relationshipWeightProperty configuration parameter.
- Weighted relationships
-
Weighted trait. The algorithm treats each relationship as equally important, discarding the value of any relationship weight.
Introduction
Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph. The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph.
Syntax
This section covers the syntax used to execute the Articulation Points algorithm in each of its execution modes. We are describing the named graph variant of the syntax. To learn more about general syntax variants, see Syntax overview.
CALL gds.articulationPoints.stream(
graphName: String,
configuration: Map
)
YIELD
nodeId: Integer
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. Relationships with any of the given types will be included. |
|
Integer |
|
yes |
The algorithm is single-threaded and changing the concurrency parameter has no effect on the runtime. |
|
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
Boolean |
|
yes |
If disabled the progress percentage will not be logged. |
Name | Type | Description |
---|---|---|
nodeId |
Integer |
The ID of the node representing an articulation point. |
CALL gds.articulationPoints.stats(
graphName: String,
configuration: Map
)
YIELD
nodeId: Integer
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. Relationships with any of the given types will be included. |
|
Integer |
|
yes |
The algorithm is single-threaded and changing the concurrency parameter has no effect on the runtime. |
|
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
Boolean |
|
yes |
If disabled the progress percentage will not be logged. |
Name | Type | Description |
---|---|---|
Name |
Type |
Description |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
articulationPointCount |
Integer |
Count of the articulation points in the graph. |
configuration |
Map |
The configuration used for running the algorithm. |
CALL gds.articulationPoints.mutate(
graphName: String,
configuration: Map
)
YIELD
mutateMillis: Integer,
nodePropertiesWritten: Integer,
computeMillis: Integer,
articulationPointCount: Integer,
configuration: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description include::partial$/algorithms/common-configuration/common-mutate-configuration-entries.adoc |
---|
Name | Type | Description |
---|---|---|
mutateMillis |
Integer |
Milliseconds for adding properties to the projected graph. |
nodePropertiesWritten |
Integer |
Number of properties added to the projected graph. |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
articulationPointCount |
Integer |
Count of the articulation points in the graph. |
configuration |
Map |
The configuration used for running the algorithm. |
CALL gds.articulationPoints.write(
graphName: String,
configuration: Map
)
YIELD
writeMillis: Integer,
nodePropertiesWritten: Integer,
computeMillis: Integer,
articulationPointCount: Integer,
configuration: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description include::partial$/algorithms/common-configuration/common-mutate-configuration-entries.adoc |
---|
Name | Type | Description |
---|---|---|
writeMillis |
Integer |
Milliseconds for adding properties to the neo4j database. |
nodePropertiesWritten |
Integer |
Number of properties added to the neo4j database.. |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
articulationPointCount |
Integer |
Count of the articulation points in the graph. |
configuration |
Map |
The configuration used for running the algorithm. |
Examples
All the examples below should be run in an empty database. The examples use Cypher projections as the norm. Native projections will be deprecated in a future release. |
In this section we will show examples of running the Articulation Points algorithm on a concrete graph. The intention is to illustrate what the results look like and to provide a guide in how to make use of the algorithm in a real setting. We will do this on a small social network graph of a handful nodes connected in a particular pattern. The example graph looks like this:
CREATE
(nAlice:User {name: 'Alice'}),
(nBridget:User {name: 'Bridget'}),
(nCharles:User {name: 'Charles'}),
(nDoug:User {name: 'Doug'}),
(nMark:User {name: 'Mark'}),
(nMichael:User {name: 'Michael'}),
(nAlice)-[:LINK]->(nBridget),
(nAlice)-[:LINK]->(nCharles),
(nCharles)-[:LINK]->(nBridget),
(nAlice)-[:LINK]->(nDoug),
(nMark)-[:LINK]->(nDoug),
(nMark)-[:LINK]->(nMichael),
(nMichael)-[:LINK]->(nDoug);
This graph has two clusters of Users, that are closely connected. Between those clusters there is one single edge.
MATCH (source:User)-[r:LINK]->(target:User)
RETURN gds.graph.project(
'myGraph',
source,
target,
{},
{ undirectedRelationshipTypes: ['*'] }
)
Memory Estimation
First off, we will estimate the cost of running the algorithm using the estimate
procedure.
This can be done with any execution mode.
We will use the stream
mode in this example.
Estimating the algorithm is useful to understand the memory impact that running the algorithm on your graph will have.
When you later actually run the algorithm in one of the execution modes the system will perform an estimation.
If the estimation shows that there is a very high probability of the execution going over its memory limitations, the execution is prohibited.
To read more about this, see Automatic estimation and execution blocking.
For more details on estimate
in general, see Memory Estimation.
CALL gds.articulationPoints.stream.estimate('myGraph', {})
YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory
nodeCount | relationshipCount | bytesMin | bytesMax | requiredMemory |
---|---|---|---|---|
6 |
14 |
984 |
984 |
"984 Bytes" |
Stream
In the stream
execution mode, the algorithm returns the node property for each node.
This allows us to inspect the results directly or post-process them in Cypher without any side effects.
For more details on the stream
mode in general, see Stream.
stream
mode:CALL gds.articulationPoints.stream('myGraph')
YIELD nodeId
RETURN gds.util.asNode(nodeId).name AS name
ORDER BY name ASC
name |
---|
"Alice" |
"Doug" |
Stats
In the stats
execution mode, the algorithm returns a single row containing a summary of the algorithm result.
This execution mode does not have any side effects.
It can be useful for evaluating algorithm performance by inspecting the computeMillis
return item.
In the examples below we will omit returning the timings.
The full signature of the procedure can be found in the syntax section.
For more details on the stats
mode in general, see Stats.
stats
mode:CALL gds.articulationPoints.stats('myGraph',{})
YIELD articulationPointCount
articulationPointCount |
---|
2 |
Mutate
The mutate
mode updates the named graph with a new node property that denotes whether a node is an articulation point or not.
This is achieved through setting 0,1
values, where 1
denotes that the node is an articulation point.
The name of the new property is specified using the mandatory configuration parameter mutateProperty
.
The result is a single summary row, similar to stats
, but with some additional metrics.
mutate
mode:CALL gds.articulationPoints.mutate('myGraph', { mutateProperty: 'articulationPoint'})
YIELD articulationPointCount
articulationPointCount |
---|
2 |
Write
The write
mode updates the Neo4j graph with a new node property that denotes whether a node is an articulation point or not.
This is achieved through setting 0,1
values, where 1
denotes that the node is an articulation point.
The name of the new property is specified using the mandatory configuration parameter writeProperty
.
The result is a single summary row, similar to stats
, but with some additional metrics.
The mutate
mode is especially useful when multiple algorithms are used in conjunction.
write
mode:CALL gds.articulationPoints.write('myGraph', { writeProperty: 'articulationPoint'})
YIELD articulationPointCount
articulationPointCount |
---|
2 |
Then we can then query Neo4j to see the articulation points:
MATCH (n { articulationPoint: 1 }) RETURN n.name AS name ORDER BY name ASC
name |
---|
"Alice" |
"Doug" |
Or we can query Neo4j to see the nodes that are not articulation points:
MATCH (n { articulationPoint: 0 }) RETURN n.name AS name ORDER BY name ASC
name |
---|
"Bridget" |
"Charles" |
"Mark" |
"Michael" |