File size: 533 Bytes
2e818da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Shared schema for the network-family D3 templates
(network_force_graph, network_arc_diagram, network_chord, network_adjacency_matrix).

Not registered itself — imported by each network template module.
"""
from __future__ import annotations
from pydantic import BaseModel, Field


class GraphNode(BaseModel):
    id: str
    group: str = ""


class GraphLink(BaseModel):
    source: str
    target: str
    value: float = 1


class GraphData(BaseModel):
    title: str = ""
    nodes: list[GraphNode]
    links: list[GraphLink]