Struct egui_graphs::Graph
source · pub struct Graph<N: Clone, E: Clone, Ty: EdgeType> {
pub g: StableGraph<Node<N>, Edge<E>, Ty>,
}Expand description
Graph type compatible with super::GraphView.
Fields§
§g: StableGraph<Node<N>, Edge<E>, Ty>Implementations§
source§impl<'a, N: Clone, E: Clone, Ty: EdgeType> Graph<N, E, Ty>
impl<'a, N: Clone, E: Clone, Ty: EdgeType> Graph<N, E, Ty>
pub fn new(g: StableGraph<Node<N>, Edge<E>, Ty>) -> Self
sourcepub fn walk(
&self,
walker: impl FnMut(&Self, Option<&NodeIndex>, Option<&Node<N>>, Option<&EdgeIndex>, Option<&Edge<E>>)
)
pub fn walk( &self, walker: impl FnMut(&Self, Option<&NodeIndex>, Option<&Node<N>>, Option<&EdgeIndex>, Option<&Edge<E>>) )
Iterates over all nodes and edges and calls the walker function.
sourcepub fn node_by_pos(
&self,
comp: &'a StateComputed,
meta: &'a Metadata,
pos: Pos2
) -> Option<(NodeIndex, &Node<N>)>
pub fn node_by_pos( &self, comp: &'a StateComputed, meta: &'a Metadata, pos: Pos2 ) -> Option<(NodeIndex, &Node<N>)>
Finds node by position. Can be optimized by using a spatial index like quad-tree if needed.
pub fn g(&mut self) -> &mut StableGraph<Node<N>, Edge<E>, Ty>
sourcepub fn nodes_iter(&'a self) -> impl Iterator<Item = (NodeIndex, &Node<N>)>
pub fn nodes_iter(&'a self) -> impl Iterator<Item = (NodeIndex, &Node<N>)>
Provides iterator over all nodes and their indices.
sourcepub fn edges_iter(&'a self) -> impl Iterator<Item = (EdgeIndex, &Edge<E>)>
pub fn edges_iter(&'a self) -> impl Iterator<Item = (EdgeIndex, &Edge<E>)>
Provides iterator over all edges and their indices.
pub fn node(&self, i: NodeIndex) -> Option<&Node<N>>
pub fn edge(&self, i: EdgeIndex) -> Option<&Edge<E>>
pub fn edge_endpoints(&self, i: EdgeIndex) -> Option<(NodeIndex, NodeIndex)>
pub fn node_mut(&mut self, i: NodeIndex) -> Option<&mut Node<N>>
pub fn is_directed(&self) -> bool
pub fn edges_num(&self, idx: NodeIndex) -> usize
pub fn edges_directed( &self, idx: NodeIndex, dir: Direction ) -> impl Iterator<Item = EdgeReference<'_, Edge<E>>>
Trait Implementations§
Auto Trait Implementations§
impl<N, E, Ty> RefUnwindSafe for Graph<N, E, Ty>where E: RefUnwindSafe, N: RefUnwindSafe, Ty: RefUnwindSafe,
impl<N, E, Ty> Send for Graph<N, E, Ty>where E: Send, N: Send, Ty: Send,
impl<N, E, Ty> Sync for Graph<N, E, Ty>where E: Sync, N: Sync, Ty: Sync,
impl<N, E, Ty> Unpin for Graph<N, E, Ty>where E: Unpin, N: Unpin, Ty: Unpin,
impl<N, E, Ty> UnwindSafe for Graph<N, E, Ty>where E: UnwindSafe, N: UnwindSafe, Ty: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more