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§
Source§impl<N, E, S: Shape> LatticeGraph<N, E, S>
impl<N, E, S: Shape> LatticeGraph<N, E, S>
Sourcepub unsafe fn new_uninit(s: S) -> Self
pub unsafe fn new_uninit(s: S) -> Self
Creates a graph with uninitalized node and edge weight data.
It is extremely unsafe so should use with MaybeUninit
and use assume_init
.
Source§impl<N, E, S: Shape + Default> LatticeGraph<N, E, S>
impl<N, E, S: Shape + Default> LatticeGraph<N, E, S>
Sourcepub unsafe fn new_uninit_s() -> Self
pub unsafe fn new_uninit_s() -> Self
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
.
Sourcepub fn new_with_s<FN, FE>(n: FN, e: FE) -> Self
pub fn new_with_s<FN, FE>(n: FN, e: FE) -> Self
Creates a graph with node and edge weight data from the coordinate with Shape
from default.
Source§impl<N, E, S: Shape> LatticeGraph<MaybeUninit<N>, MaybeUninit<E>, S>
impl<N, E, S: Shape> LatticeGraph<MaybeUninit<N>, MaybeUninit<E>, S>
Sourcepub unsafe fn assume_init(self) -> LatticeGraph<N, E, S>
pub unsafe fn assume_init(self) -> LatticeGraph<N, E, S>
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§
Source§impl<N: Clone, E: Clone, S: Clone + Shape> Clone for LatticeGraph<N, E, S>
impl<N: Clone, E: Clone, S: Clone + Shape> Clone for LatticeGraph<N, E, S>
Source§fn clone(&self) -> LatticeGraph<N, E, S>
fn clone(&self) -> LatticeGraph<N, E, S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<N, E, S: Shape> Data for LatticeGraph<N, E, S>
impl<N, E, S: Shape> Data for LatticeGraph<N, E, S>
type NodeWeight = N
type EdgeWeight = E
Source§impl<N, E, S: Shape> DataMap for LatticeGraph<N, E, S>
impl<N, E, S: Shape> DataMap for LatticeGraph<N, E, S>
fn node_weight(&self, id: Self::NodeId) -> Option<&Self::NodeWeight>
fn edge_weight(&self, id: Self::EdgeId) -> Option<&Self::EdgeWeight>
Source§impl<N, E, S: Shape> DataMapMut for LatticeGraph<N, E, S>
impl<N, E, S: Shape> DataMapMut for LatticeGraph<N, E, S>
fn node_weight_mut(&mut self, id: Self::NodeId) -> Option<&mut Self::NodeWeight>
fn edge_weight_mut(&mut self, id: Self::EdgeId) -> Option<&mut Self::EdgeWeight>
Source§impl<N, E, S> Default for LatticeGraph<N, E, S>
impl<N, E, S> Default for LatticeGraph<N, E, S>
Source§impl<N, E, S: Shape> Drop for LatticeGraph<N, E, S>
impl<N, E, S: Shape> Drop for LatticeGraph<N, E, S>
Source§impl<N, E, S, C> GetAdjacencyMatrix for LatticeGraph<N, E, S>
impl<N, E, S, C> GetAdjacencyMatrix for LatticeGraph<N, E, S>
Source§fn adjacency_matrix(&self) -> Self::AdjMatrix
fn adjacency_matrix(&self) -> Self::AdjMatrix
Create the adjacency matrix
Source§impl<N, E, S: Shape> GraphBase for LatticeGraph<N, E, S>
impl<N, E, S: Shape> GraphBase for LatticeGraph<N, E, S>
Source§impl<N, E, S: Shape> GraphProp for LatticeGraph<N, E, S>
impl<N, E, S: Shape> GraphProp for LatticeGraph<N, E, S>
fn is_directed(&self) -> bool
Source§impl<'a, N, E, S, C, D, A> IntoEdgeReferences for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S, C, D, A> IntoEdgeReferences for &'a LatticeGraph<N, E, S>
type EdgeRef = EdgeReference<'a, C, E, D, A>
type EdgeReferences = EdgeReferences<'a, N, E, S>
fn edge_references(self) -> Self::EdgeReferences
Source§impl<'a, N, E, S, C, D, A> IntoEdges for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S, C, D, A> IntoEdges for &'a LatticeGraph<N, E, S>
Source§impl<'a, N, E, S, C, D, A> IntoEdgesDirected for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S, C, D, A> IntoEdgesDirected for &'a LatticeGraph<N, E, S>
type EdgesDirected = Edges<'a, N, E, S, <S as Shape>::Coordinate, Direction>
fn edges_directed(self, a: Self::NodeId, dir: Direction) -> Self::EdgesDirected
Source§impl<'a, N, E, S, D> IntoNeighbors for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S, D> IntoNeighbors for &'a LatticeGraph<N, E, S>
Source§impl<'a, N, E, S, D> IntoNeighborsDirected for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S, D> IntoNeighborsDirected for &'a LatticeGraph<N, E, S>
type NeighborsDirected = Neighbors<'a, N, E, S>
fn neighbors_directed(self, a: Self::NodeId, _d: Direction) -> Self::Neighbors
Source§impl<'a, N, E, S: Shape> IntoNodeIdentifiers for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S: Shape> IntoNodeIdentifiers for &'a LatticeGraph<N, E, S>
type NodeIdentifiers = NodeIndices<S>
fn node_identifiers(self) -> Self::NodeIdentifiers
Source§impl<'a, N, E, S: Shape> IntoNodeReferences for &'a LatticeGraph<N, E, S>
impl<'a, N, E, S: Shape> IntoNodeReferences for &'a LatticeGraph<N, E, S>
type NodeRef = (<S as Shape>::Coordinate, &'a N)
type NodeReferences = NodeReferences<'a, N, E, S>
fn node_references(self) -> Self::NodeReferences
Source§impl<N, E, S: Shape> NodeCount for LatticeGraph<N, E, S>
impl<N, E, S: Shape> NodeCount for LatticeGraph<N, E, S>
fn node_count(&self) -> usize
Source§impl<N, E, S: Shape> NodeIndexable for LatticeGraph<N, E, S>
impl<N, E, S: Shape> NodeIndexable for LatticeGraph<N, E, S>
Source§fn node_bound(&self) -> usize
fn node_bound(&self) -> usize
Return an upper bound of the node indices in the graph
(suitable for the size of a bitmap).
Source§fn from_index(&self, i: usize) -> Self::NodeId
fn from_index(&self, i: usize) -> Self::NodeId
Convert
i
to a node index. i
must be a valid value in the graph.impl<N: Eq, E: Eq, S: Eq + Shape> Eq for LatticeGraph<N, E, S>
impl<N, E, S: Shape> NodeCompactIndexable for LatticeGraph<N, E, S>
impl<N, E, S: Shape> StructuralPartialEq for LatticeGraph<N, E, S>
Auto Trait Implementations§
impl<N, E, S> Freeze for LatticeGraph<N, E, S>where
S: Freeze,
impl<N, E, S> RefUnwindSafe for LatticeGraph<N, E, S>
impl<N, E, S> Send for LatticeGraph<N, E, S>
impl<N, E, S> Sync for LatticeGraph<N, E, S>
impl<N, E, S> Unpin for LatticeGraph<N, E, S>where
S: Unpin,
impl<N, E, S> UnwindSafe for LatticeGraph<N, E, S>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConstOrValue<T> for T
impl<T> ConstOrValue<T> for T
Source§const IS_CONST_WRAP: bool = false
const IS_CONST_WRAP: bool = false
get wheter the type is const generic wrapper.
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.