> ## Documentation Index
> Fetch the complete documentation index at: https://hexxladb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Edges

> Edge operations: PutEdge, GetEdge, LinkCells

## PutEdge

Store a directed edge primary.

```go theme={null}
fromPk, _ := lattice.Pack(hexxladb.Coord{Q: 3, R: 1})
toPk, _ := lattice.Pack(hexxladb.Coord{Q: 4, R: 2})

err := tx.PutEdge(ctx, record.EdgeRecord{
    From:         fromPk,
    To:           toPk,
    RelationType: "see-also",
    Weight:       1.0,
    Provenance: record.ProvenanceWire{
        SourceID:   "session-2",
        Confidence: 0.9,
    },
})
```

## GetEdge

Edge lookup by endpoints and relation type.

```go theme={null}
edge, ok, err := tx.GetEdge(ctx, fromPk, toPk, "see-also")
if err != nil {
    return err
}
if !ok {
    return errors.New("edge not found")
}
fmt.Printf("Weight: %f\n", edge.Weight)
```

## AscendEdgesFrom

Iterate all out-edges from a packed coordinate.

```go theme={null}
err := tx.AscendEdgesFrom(ctx, fromPk, func(edge record.EdgeRecord) bool {
    fmt.Printf("Relation: %s, Weight: %f\n", edge.RelationType, edge.Weight)
    return true // continue iteration
})
```

## LinkCells

Sugar: pack coords and put edge.

```go theme={null}
from := hexxladb.Coord{Q: 3, R: 1}
to := hexxladb.Coord{Q: 4, R: 2}

err := tx.LinkCells(ctx, from, to, "see-also", 1.0, record.ProvenanceWire{
    SourceID:   "session-2",
    Confidence: 0.9,
})
```

## Common relation types

While you can define any relation type string, common patterns include:

| Relation type  | Use case                                |
| -------------- | --------------------------------------- |
| `see-also`     | Related content worth exploring         |
| `follow-up`    | Next item in a sequence or conversation |
| `derived-from` | Source material or parent document      |
| `depends-on`   | Prerequisite relationship               |
| `related-to`   | General association                     |

## See also

* [Edges](/concepts/edges) — Edge concepts and use cases
