pub struct RelationshipGraph {
pub num_nodes: usize,
pub max_weight: u64,
pub registry: ResourceRegistry<EdgeKey, ()>,
}Expand description
A weighted directed graph whose only mutable edge owner is ResourceRegistry.
Fields§
§num_nodes: usizeNumber of nodes in the fixed universe.
max_weight: u64Inclusive edge-weight ceiling.
registry: ResourceRegistry<EdgeKey, ()>Owner of exact weighted edges.
Implementations§
Source§impl RelationshipGraph
impl RelationshipGraph
Sourcepub fn new(num_nodes: usize, max_weight: u64) -> RelationshipGraph
pub fn new(num_nodes: usize, max_weight: u64) -> RelationshipGraph
Construct an empty graph from an empty edge registry.
Sourcepub fn can_add_edge(&self, source: usize, target: usize, weight: u64) -> bool
pub fn can_add_edge(&self, source: usize, target: usize, weight: u64) -> bool
Whether an exact weighted edge can be inserted.
Sourcepub fn contains_exact_edge(
&self,
source: usize,
target: usize,
weight: u64,
) -> bool
pub fn contains_exact_edge( &self, source: usize, target: usize, weight: u64, ) -> bool
Query exact membership through the ResourceRegistry owner.
Sourcepub fn contains_pair(&self, source: usize, target: usize) -> bool
pub fn contains_pair(&self, source: usize, target: usize) -> bool
Scan the edge registry to answer the derived adjacency query.
Sourcepub fn add_edge(&mut self, source: usize, target: usize, weight: u64) -> bool
pub fn add_edge(&mut self, source: usize, target: usize, weight: u64) -> bool
Register one exact weighted edge.
Sourcepub fn remove_edge(&mut self, source: usize, target: usize)
pub fn remove_edge(&mut self, source: usize, target: usize)
Remove every registered weight for one source/destination pair.
Auto Trait Implementations§
impl Freeze for RelationshipGraph
impl RefUnwindSafe for RelationshipGraph
impl Send for RelationshipGraph
impl Sync for RelationshipGraph
impl Unpin for RelationshipGraph
impl UnsafeUnpin for RelationshipGraph
impl UnwindSafe for RelationshipGraph
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