# types/graph.types.ts

> 46 lines of code and 10 definitions.

Tree: Site tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/tree#file-types-graph-types-ts
Source text: https://banes-lab.com/source/tree/types/graph.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/tree/types.md), after [types/grammar.types.ts](https://banes-lab.com/source/tree/types/grammar.types.ts.md) and before [types/home.types.ts](https://banes-lab.com/source/tree/types/home.types.ts.md).

## Definitions

- `GraphLayer` (type_alias_declaration, line 1, exported)
- `GraphAddress` (interface_declaration, line 3, exported)
- `GraphNode` (interface_declaration, line 8, exported)
- `ChunkTarget` (interface_declaration, line 20, exported)
- `ChunkRelation` (interface_declaration, line 26, exported)
- `ChunkNode` (interface_declaration, line 31, exported)
- `GraphChunk` (type_alias_declaration, line 38, exported)
- `GraphEdge` (interface_declaration, line 40, exported)
- `RelationPair` (interface_declaration, line 46, exported)
- `RelationRecord` (interface_declaration, line 51, exported)

## Source

```typescript
export type GraphLayer = "api" | "ontology" | "site" | `source:${string}`;

export interface GraphAddress {
    readonly json: string;
    readonly markdown: string | null;
}

export interface GraphNode {
    readonly address: GraphAddress | null;
    readonly citation: string | null;
    readonly fields: Readonly<Record<string, unknown>>;
    readonly href: string | null;
    readonly kind: string;
    readonly layer: GraphLayer;
    readonly number: string | null;
    readonly ref: string;
    readonly title: string;
}

export interface ChunkTarget {
    readonly href: string | null;
    readonly number: string | null;
    readonly title: string;
}

export interface ChunkRelation {
    readonly relation: string;
    readonly targets: readonly ChunkTarget[];
}

export interface ChunkNode {
    readonly kind: string;
    readonly number: string | null;
    readonly relations: readonly ChunkRelation[];
    readonly title: string;
}

export type GraphChunk = Readonly<Record<string, ChunkNode>>;

export interface GraphEdge {
    readonly from: string;
    readonly relation: string;
    readonly to: string;
}

export interface RelationPair {
    readonly forward: string;
    readonly reverse: string;
}

export interface RelationRecord extends RelationPair {
    readonly leaf: RelationPair | null;
    readonly rollsUp: boolean;
    readonly tooltip: boolean;
}
```
