Docs menu · Reference

Adds a directed edge src -[edge_type]-> dst or replaces it if the same triple already exists. Both endpoints must already exist; writing an edge to a missing node fails with invalid_argument.engine.graph_edge_endpoint. Weight defaults to 1.0 and must not be negative. Once the graph’s ontology is frozen, the edge type and its endpoint object types are validated against the declared link types.

Successful mutations return an acknowledgement that identifies the affected target, the mutation effect, and commit facts when the operation changed stored state.

Examples

Add a typed edge between two nodes.

CLI

$ strata graph create social
$ strata graph add-node social alice
$ strata graph add-node social bob
$ strata graph add-edge social alice knows bob
$ strata graph get-edge social alice knows bob

Wire

{"graph":"social","type":"graph_create"}
{"graph":"social","node_id":"alice","type":"graph_add_node"}
{"graph":"social","node_id":"bob","type":"graph_add_node"}
{"dst":"bob","edge_type":"knows","graph":"social","src":"alice","type":"graph_add_edge"}
{"dst":"bob","edge_type":"knows","graph":"social","src":"alice","type":"graph_get_edge"}

Parameters

NameTypeRequiredDescription
dststringyesDestination node id.
edge_typestringyesEdge type.
graphstringyesGraph name.
propertiesanynoOptional edge properties.
srcstringyesSource node id.
weightnumbernoOptional edge weight. Defaults to 1.0.

Plus the optional scope: branch and space (default to the session branch and the "default" space).

Returns

MutationAck<GraphEdgeWrite>.

Errors

Invocation

  • CLI: strata graph add-edge
  • Wire type: graph_add_edge

agents: this page as markdown → /docs/reference/graph/edge/add.md