System graphs as collections of nodes (any Nostr event) and edges (connection events).
Specification
Graph Container Event (kind 30048)
Purpose: Lists the nodes and edges of a graph.
Required Tags
-
["d", "graph-unique-id"] (deterministic id)
-
["title", "Graph Title"]
-
["node", "<event_id>"] (one for each node, required)
-
["edge", "<event_id>"] (one for each edge, required)
Optional Tags
-
["summary", "Description"]
Example
{
"kind": 30048,
"tags": [
["d", "photosynthesis-graph"],
["title", "Photosynthesis"],
["node", "eventid1"],
["node", "eventid2"],
["node", "eventid3"],
["edge", "edgeid1"],
["edge", "edgeid2"],
["summary", "A graph of the photosynthesis process"]
],
"content": ""
}
Edge/Connection Event (kind 30049)
Purpose: Describes a connection between any two Nostr events (usually nodes in the graph).
Required Tags
-
["from", "<event_id>"] // Source node/event
-
["to", "<event_id>"] // Target node/event
-
["type", "<type>"] // e.g. dependency, reference, +, -, etc.
-
["direction", "uni"|"bi"] // uni=one-way, bi=bidirectional
-
["fromSide", "top"|"bottom"|"left"|"right"]
-
["toSide", "top"|"bottom"|"left"|"right"]
-
["fromEnd", "none"|"arrow"]
-
["toEnd", "none"|"arrow"]
Optional Tags
-
["description", "<desc>"] // Human-readable label / description
Example
{
"kind": 30049,
"tags": [
["from", "eventid1"],
["to", "eventid2"],
["type", "+"],
["direction", "uni"],
["fromSide", "right"],
["toSide", "left"],
["fromEnd", "none"],
["toEnd", "arrow"],
],
"content": ""
}
Interoperability
No layout, dimension, or position attributes (such as x/y coordinates, width, height, color, etc.) are included. This is to maximize interoperability and client freedom: each client is free to render and organize nodes and edges as it sees fit, using only the graph structure and connection metadata.
It’s best practice to use the first mentioned node as a starting point to build the graph from.
Comments
Public conversation about this article.
No comments yet.
Article metadata
About this entry
Event Id
Raw event
Other authors
No one else has published this topic yet.