Trait WeightedGraph

Source
pub trait WeightedGraph<V>: GraphEngine {
    type WeightRef: Deref<Target = V>;
    type WeightMut: DerefMut<Target = V>;

    // Required methods
    fn get_node_weight(&self, node: usize) -> Option<Self::WeightRef>;
    fn mut_node_weight(&self, node: usize) -> Option<Self::WeightMut>;
    fn set_node_weight(&mut self, node: usize, weight: V);
    fn get_edge_weight<Q>(&self, edge: Q) -> Option<Self::WeightRef>
       where Q: Into<EdgeQuery>;
    fn mut_edge_weight<Q>(&self, edge: Q) -> Option<Self::WeightMut>
       where Q: Into<EdgeQuery>;
    fn set_edge_weight<Q>(&mut self, edge: Q, weight: V)
       where Q: Into<EdgeQuery>;
}
Expand description

Labeling a graph can provide Weight information

§Examples

use graph_theory::GraphEngine;

Required Associated Types§

Source

type WeightRef: Deref<Target = V>

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

type WeightMut: DerefMut<Target = V>

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;

Required Methods§

Source

fn get_node_weight(&self, node: usize) -> Option<Self::WeightRef>

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

fn mut_node_weight(&self, node: usize) -> Option<Self::WeightMut>

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

fn set_node_weight(&mut self, node: usize, weight: V)

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

fn get_edge_weight<Q>(&self, edge: Q) -> Option<Self::WeightRef>
where Q: Into<EdgeQuery>,

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

fn mut_edge_weight<Q>(&self, edge: Q) -> Option<Self::WeightMut>
where Q: Into<EdgeQuery>,

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;
Source

fn set_edge_weight<Q>(&mut self, edge: Q, weight: V)
where Q: Into<EdgeQuery>,

Remove edge by given edge-id or start and end node-id.

§Panics
  • No such ability

Not all graph engine supports insert edge.

§Examples
use graph_theory::GraphEngine;

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§