leptos-node-graph 0.2.2

A reactive node graph editor component for Leptos
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::collections::HashMap;

use crate::types::*;

#[derive(Clone, Debug)]
pub struct LayoutGraph<N: NodeId, P: PortId> {
    pub nodes: HashMap<N, Size>,
    pub edges: Vec<(N, N)>,
    pub port_to_node: HashMap<P, N>,
}

pub trait LayoutEngine<N: NodeId, P: PortId> {
    fn compute(&self, graph: &LayoutGraph<N, P>) -> HashMap<N, Position>;
}