Struct lattice_graph::lattice_abstract::LatticeGraph
source · [−]pub struct LatticeGraph<N, E, S: Shape> { /* private fields */ }
Expand description
Abstract Lattice Graph.
It holds the node and edge weight data.
The actural behaviour is dependent on Shape
.
Implementations
Creates a graph with uninitalized node and edge weight data.
It is extremely unsafe so should use with MaybeUninit
and use assume_init
.
Creates a graph with node and edge weight data set to default
.
pub fn new_with<FN, FE>(s: S, n: FN, e: FE) -> Self where
FN: FnMut(S::Coordinate) -> N,
FE: FnMut(S::Coordinate, S::Axis) -> E,
pub fn new_with<FN, FE>(s: S, n: FN, e: FE) -> Self where
FN: FnMut(S::Coordinate) -> N,
FE: FnMut(S::Coordinate, S::Axis) -> E,
Creates a graph with node and edge weight data from the coordinate.
Creates a graph with uninitalized node and edge weight data with Shape
from default.
It is extremely unsafe so should use with MaybeUninit
and use assume_init
.
pub fn new_with_s<FN, FE>(n: FN, e: FE) -> Self where
FN: FnMut(S::Coordinate) -> N,
FE: FnMut(S::Coordinate, S::Axis) -> E,
pub fn new_with_s<FN, FE>(n: FN, e: FE) -> Self where
FN: FnMut(S::Coordinate) -> N,
FE: FnMut(S::Coordinate, S::Axis) -> E,
Creates a graph with node and edge weight data from the coordinate with Shape
from default.
Assume the underlying nodes and edges to be initialized.
let mut hex = unsafe { HexGraphConst::<MaybeUninit<f32>, MaybeUninit<()>, OddR, 5, 5>::new_uninit_s() };
for i in 0..5{
for j in 0..5{
let offset = Offset::new(i, j);
let coord = hex.shape().from_offset(offset);
if let Some(ref mut n) = hex.node_weight_mut(coord){
**n = MaybeUninit::new((i + j) as f32);
}
}
}
let hex_init = unsafe{ hex.assume_init() };
Trait Implementations
type NodeWeight = N
type EdgeWeight = E
impl<N, E, S, C> GetAdjacencyMatrix for LatticeGraph<N, E, S> where
C: Copy + PartialEq,
S: Shape<Coordinate = C>,
impl<N, E, S, C> GetAdjacencyMatrix for LatticeGraph<N, E, S> where
C: Copy + PartialEq,
S: Shape<Coordinate = C>,
Create the adjacency matrix
type NodeId = S::Coordinate
type NodeId = S::Coordinate
node identifier
type EdgeId = (S::Coordinate, S::Axis)
type EdgeId = (S::Coordinate, S::Axis)
edge identifier
type EdgeType = EdgeTypeWrap<S::Axis>
type EdgeType = EdgeTypeWrap<S::Axis>
The kind edges in the graph.
impl<'a, N, E, S, C, D, A> IntoEdgeReferences for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
impl<'a, N, E, S, C, D, A> IntoEdgeReferences for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
type EdgeRef = EdgeReference<'a, C, E, D, A>
type EdgeReferences = EdgeReferences<'a, N, E, S>
impl<'a, N, E, S, C, D, A> IntoEdges for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
impl<'a, N, E, S, C, D, A> IntoEdges for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
impl<'a, N, E, S, C, D, A> IntoEdgesDirected for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
impl<'a, N, E, S, C, D, A> IntoEdgesDirected for &'a LatticeGraph<N, E, S> where
C: Copy,
S: Shape<Coordinate = C, Axis = A>,
A: Axis<Direction = D>,
D: AxisDirection + Copy,
type EdgesDirected = EdgesDirected<'a, N, E, S>
impl<'a, N, E, S, D> IntoNeighbors for &'a LatticeGraph<N, E, S> where
S: Shape,
S::Axis: Axis<Direction = D>,
D: AxisDirection + Clone,
impl<'a, N, E, S, D> IntoNeighbors for &'a LatticeGraph<N, E, S> where
S: Shape,
S::Axis: Axis<Direction = D>,
D: AxisDirection + Clone,
impl<'a, N, E, S, D> IntoNeighborsDirected for &'a LatticeGraph<N, E, S> where
S: Shape,
S::Axis: Axis<Direction = D>,
D: AxisDirection + Clone,
impl<'a, N, E, S, D> IntoNeighborsDirected for &'a LatticeGraph<N, E, S> where
S: Shape,
S::Axis: Axis<Direction = D>,
D: AxisDirection + Clone,
type NeighborsDirected = Neighbors<'a, N, E, S>
type NodeIdentifiers = NodeIndices<S>
type NodeReferences = NodeReferences<'a, N, E, S>
Return an upper bound of the node indices in the graph (suitable for the size of a bitmap). Read more
Convert i
to a node index. i
must be a valid value in the graph.
impl<N: PartialEq, E: PartialEq, S: PartialEq + Shape> PartialEq<LatticeGraph<N, E, S>> for LatticeGraph<N, E, S>
impl<N: PartialEq, E: PartialEq, S: PartialEq + Shape> PartialEq<LatticeGraph<N, E, S>> for LatticeGraph<N, E, S>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<N, E, S> RefUnwindSafe for LatticeGraph<N, E, S> where
E: RefUnwindSafe,
N: RefUnwindSafe,
S: RefUnwindSafe,
impl<N, E, S> Send for LatticeGraph<N, E, S> where
E: Send,
N: Send,
S: Send,
impl<N, E, S> Sync for LatticeGraph<N, E, S> where
E: Sync,
N: Sync,
S: Sync,
impl<N, E, S> Unpin for LatticeGraph<N, E, S> where
S: Unpin,
impl<N, E, S> UnwindSafe for LatticeGraph<N, E, S> where
E: RefUnwindSafe,
N: RefUnwindSafe,
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
get wheter the type is const generic wrapper.
Compare self to key
and return true
if they are equal.