Graph Data Science

relationship aggregation

Collapsing the parallel relationships between two nodes into one during projection, usually carrying their count or sum as its weight.

Example

Ava bought a kettle and a mug. Ben bought six of the same mug.

cypher
MATCH (source:Customer)-[:BOUGHT]->(target:Product)
WITH source, target, count(*) AS purchases
RETURN gds.graph.project('customer-products', source, target, {
  relationshipProperties: { weight: purchases }
})

The projection holds one relationship for each pair of nodes.

Ben's six relationships to the mug become one carrying weight: 6. Ava bought each of two products once, so those come through carrying weight: 1. An algorithm reading weight still counts six purchases for Ben, without following six relationships to do it.

Lessons that use this term

The lesson and course links below open in a new tab.

No published lesson uses this term yet.

All glossary terms