liveBook · Manning

Relationship property

As explained in Graph Algorithms for Data Science

A property is a named value attached to a graph element in a labeled-property graph.

A relationship property is a named value stored as a key-value pair on a graph relationship. It records information about the connection itself, such as when a friendship began or when a social-media interaction occurred. section 2.2.1 section 2.3.2

Use relationship properties when an attribute describes the connection rather than either connected node:

  • Store a friendship date with a FRIEND relationship, for example {since: 2016}. section 2.2
  • Store a starting date with a WRITES_FOR relationship connecting a person and an organization. section 2.2.1
  • Store the creation date of a LIKE relationship when the timing of that interaction matters. section 2.3.2

Friendship with a date

(:Person {name:"Thomas"})-[:FRIEND {since:2016}]->(:Person {name:"Elaine"}) describes two people connected by FRIEND and records 2016 on the relationship. section 2.2

(:Person {name:"Thomas"})-[:FRIEND {since:2016}]->(:Person {name:"Elaine"})

Inspect a complete Cypher pattern showing two Person nodes, a FRIEND relationship, and its since property. section 2.2

How Graph Algorithms for Data Science covers it

How deep it goes
Defines relationship properties as key-value pairs and demonstrates them through practical Cypher graph patterns.
Examples
Uses FRIEND, WRITES_FOR, and LIKE relationships with since or creation-date values as concrete examples.
What it assumes
Assumes familiarity with nodes and relationships while introducing labeled-property graph components through plain examples.
What you can do after
Apply it via Cypher by attaching domain-specific values to relationships between modeled nodes.
How it connects
Connects relationship properties with labeled-property graphs, relationship types, node properties, and Cypher patterns.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.