graph.rs

954 B · rust · 31 lines

1use super::models::CellNd;2use crate::core::error::Result;3use crate::math::graph::extract;4use crate::math::graph::models::Network;56/// Extracts the network of filled sites joined to their axis neighbors.7///8/// # Errors9///10/// Errors when the cell is neither two- nor three-dimensional.11pub fn core_graph<const N: usize>(cell: &CellNd<N>) -> Result<Network> {12    extract::core_graph(cell.types())13}1415/// Extracts the network of corners and edges outlining every filled site.16///17/// # Errors18///19/// Errors when the cell is neither two- nor three-dimensional.20pub fn edge_graph<const N: usize>(cell: &CellNd<N>) -> Result<Network> {21    extract::edge_graph(cell.types())22}2324/// Extracts the network of empty sites joined to their axis neighbors.25///26/// # Errors27///28/// Errors when the cell is neither two- nor three-dimensional.29pub fn tunnel_graph<const N: usize>(cell: &CellNd<N>) -> Result<Network> {30    extract::tunnel_graph(cell.types())31}