graph

edge.add

Add or replace a graph edge.

strata graph add-edge

wire graph_add_edge

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 of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.

To see the complete help for this command, run:

strata graph add-edge --help

Example

Add a typed edge between two nodes.

strata graph create socialstrata graph add-node social alicestrata graph add-node social bobstrata graph add-edge social alice knows bobstrata graph get-edge social alice knows bob

Parameters

NameTypeRequiredDescription
dststringyesDestination node id.
edge_typestringyesEdge type.
graphstringyesGraph name.
srcstringyesSource node id.
branchstring or nullnoTarget branch. Defaults to the executor handle branch.
propertiesanynoOptional edge properties.
spacestring or nullnoTarget product space. Defaults to `"default"`.
weightnumber or nullnoOptional edge weight. Defaults to 1.0.

Returns

MutationAck<GraphEdgeWrite>

  • dataobject
  • typestring

Errors

Recover by code. Retry policy and commit outcome come from the shipped error registry.

← All 31 Graph commands

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