# orca.graph

> A module of Orca's API.

A directed graph drawn as SVG, on the server: the pipelines and datasets that feed each other, and a snapshot's lineage.

Nodes are laid out left to right by their longest path from a node with no
edge in, and top to bottom in the order given. Each node is a box with a
label, a second line, a kind (`dataset`, `pipeline` or `snapshot`, which
the stylesheet shapes) and optionally a link and a class, such as `start`
for the snapshot a lineage page is about. Edges that would close a cycle
(a pipeline that reads the dataset it writes) are drawn but don't move a
node right.

## Structs

### `Node`

```mojo
struct Node
```

Implements: `Copyable`, `Movable`

Fields:

- `label: String`
- `sub: String`
- `kind: String`
- `href: String`: Empty for no link.
- `cls: String`: An extra class, or empty.

### `Edge`

```mojo
struct Edge
```

Implements: `Copyable`, `Movable`

Fields:

- `src: Int`
- `dst: Int`

## Functions

### `graph_svg`

```mojo
def graph_svg(nodes: List[Node], edges: List[Edge], label: String) -> String
```

The graph as an `<svg>` element, sized to fit; `label` names it for screen readers.
