network_graph 0.1.2

Network-style graph utilities and egui widget
Documentation
//! This module defines helpers for wrapping [super::GraphWidget].

use egui::Pos2;

use crate::{
    graph::{Edge, Node},
    widget::{EdgeStyle, NodeStyle},
};

pub trait GuiNode: Node {
    /// Return the current style of the node.
    fn style(&self) -> NodeStyle;

    /// Returns whether the position needs to be force updated.
    fn update_position(&self) -> bool;

    /// Updates the position within a graph.
    fn position(&self) -> Pos2;
}

pub trait GuiEdge<N>: Edge<N>
where
    N: Node,
{
    /// Return the current style of the edge.
    fn style(&self) -> EdgeStyle;
}