Edge Properties and Cardinality
Define relationship properties with typed attributes. Set cardinality (1:1, 1:N, N:1, N:M) to document relationship semantics. Add notes and configure edge direction.
Edges in graph diagrams can have properties, cardinality, and documentation just like nodes. In Graph DB mode, edge properties are included in Cypher export and represent attributes stored on Neo4j relationships.
Edge Attributes
Every edge supports these core attributes:
| Attribute | Description | Required |
|---|---|---|
| Label | Relationship type name (e.g., PLACED, CONTAINS) | Optional |
| Source Label | Text displayed near the source node | Optional |
| Target Label | Text displayed near the target node | Optional |
| Cardinality | Relationship multiplicity (1:1, 1:N, N:1, N:M) | Optional |
| Directed | Whether the relationship has direction | Default: true |
| Properties | Typed attributes on the relationship | Optional |
| Note | Markdown documentation for the edge | Optional |
| Colour | Edge stroke colour | Optional |
Cardinality
Cardinality indicates how many instances can participate in the relationship:
| Cardinality | Meaning | Example |
|---|---|---|
| 1:1 | One-to-one | Person HAS_PASSPORT Passport |
| 1:N | One-to-many | Customer PLACED Order |
| N:1 | Many-to-one | OrderLine BELONGS_TO Order |
| N:M | Many-to-many | Student ENROLLED_IN Course |
Setting Cardinality
Edge Properties
Relationships can have their own properties, just like nodes. This is useful for storing data about the relationship itself.
Adding Edge Properties
Edge Property Types
Edge properties support the same types as node properties:
| Type | Use Case |
|---|---|
| string | Relationship metadata, codes, identifiers |
| int | Quantities, counts, sequence numbers |
| float | Prices, percentages, measurements |
| boolean | Flags, toggles, status indicators |
| date | Relationship start/end dates |
| datetime | Timestamps for relationship events |
| uuid | Relationship identifiers |
| json | Complex nested data on relationships |
Direction
By default, edges are directed (have an arrow). You can make edges undirected for symmetric relationships.
| Directed | Rendering | Use Case |
|---|---|---|
| true | Arrow points from source to target | PLACED, CONTAINS, FOLLOWS |
| false | No arrow, line only | FRIENDS_WITH, RELATED_TO, SIBLING_OF |
Edge Labels
Edges support three label positions:
Customer ----[PLACED]----> Order
owner item
(sourceLabel) (targetLabel)
Edge Notes
Add documentation to edges using the Note field. Notes support Markdown formatting and appear in tooltips.
## PLACED Relationship
Represents a customer placing an order.
**Business Rules:**
- A customer can place multiple orders
- Each order belongs to exactly one customer
- The relationship stores the channel (web, mobile, phone)
Cypher Export
Edge properties and cardinality are included in Cypher export:
// Customer -[PLACED]-> Order (1:N)
// A customer places orders through various channels
MATCH (a:Customer {id: $customerId})
MATCH (b:Order {id: $orderId})
CREATE (a)-[:PLACED {
date: $date, // datetime, required
channel: $channel, // string, enum: [web,mobile,phone]
promotionCode: $promotionCode // string, nullable
}]->(b);
Validation
Edge validation in Graph DB mode checks:
| Rule | Severity | Description |
|---|---|---|
| missing-cardinality | Warning | Edge has no cardinality defined |
| duplicate-property-name | Error | Same property name used multiple times on edge |
| missing-label | Info | Edge has no relationship type label |
Edge Property Storage
Edge properties are stored in the diagram file:
{
"id": "edge-001",
"source": "node-customer",
"target": "node-order",
"label": "PLACED",
"cardinality": "1:N",
"directed": true,
"properties": [
{
"id": "prop-001",
"name": "date",
"type": "datetime",
"required": true
},
{
"id": "prop-002",
"name": "channel",
"type": "string",
"required": false
}
],
"note": "Customer places an order through a sales channel."
}