Skip to main content

NetworkGraphTraverse

Trait NetworkGraphTraverse 

pub trait NetworkGraphTraverse {
    type NodeId: Send + Sync;
    type Observed: EdgeObservableRead + Send;

    // Required methods
    fn simple_paths<C>(
        &self,
        source: &Self::NodeId,
        destination: &Self::NodeId,
        length: usize,
        take_count: Option<usize>,
        cost_fn: C,
    ) -> Vec<(Vec<Self::NodeId>, [u64; 5], <C as CostFn>::Cost)>
       where C: CostFn<Weight = Self::Observed>;
    fn simple_loopback_to_self(
        &self,
        length: usize,
        take_count: Option<usize>,
    ) -> Vec<(Vec<Self::NodeId>, [u64; 5])>;
}
Expand description

A trait specifying the graph traversal functionality.

Provides methods for finding simple paths between nodes in the network graph.

Required Associated Types§

type NodeId: Send + Sync

The identifier type used to reference nodes in the graph.

type Observed: EdgeObservableRead + Send

The concrete edge observation type used by cost functions during traversal.

Required Methods§

fn simple_paths<C>( &self, source: &Self::NodeId, destination: &Self::NodeId, length: usize, take_count: Option<usize>, cost_fn: C, ) -> Vec<(Vec<Self::NodeId>, [u64; 5], <C as CostFn>::Cost)>
where C: CostFn<Weight = Self::Observed>,

Returns a list of routes from the source to the destination with the specified length at the time of calling.

The length argument specifies the number of edges in the graph, over which the path should be formed, i.e. source -> intermediate -> destination is 2 edges.

The take count argument should be set in case the graph is expected to be large enough to be traversed slowly.

fn simple_loopback_to_self( &self, length: usize, take_count: Option<usize>, ) -> Vec<(Vec<Self::NodeId>, [u64; 5])>

Return a list of nodes with a full loopback from myself to myself.

The length argument specifies the number of edges in the graph, over which the path should be formed, i.e. source -> intermediate -> destination is 2 edges.

At least length 2 is required to provide a path through a single relay.

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.

Implementations on Foreign Types§

§

impl<'a, T> NetworkGraphTraverse for &'a T
where T: 'a + NetworkGraphTraverse + ?Sized,

§

type NodeId = <T as NetworkGraphTraverse>::NodeId

§

type Observed = <T as NetworkGraphTraverse>::Observed

§

fn simple_paths<C>( &self, source: &<&'a T as NetworkGraphTraverse>::NodeId, destination: &<&'a T as NetworkGraphTraverse>::NodeId, length: usize, take_count: Option<usize>, cost_fn: C, ) -> Vec<(Vec<<&'a T as NetworkGraphTraverse>::NodeId>, [u64; 5], <C as CostFn>::Cost)>
where C: CostFn<Weight = <&'a T as NetworkGraphTraverse>::Observed>,

§

fn simple_loopback_to_self( &self, length: usize, take_count: Option<usize>, ) -> Vec<(Vec<<&'a T as NetworkGraphTraverse>::NodeId>, [u64; 5])>

§

impl<T> NetworkGraphTraverse for Box<T>

§

type NodeId = <T as NetworkGraphTraverse>::NodeId

§

type Observed = <T as NetworkGraphTraverse>::Observed

§

fn simple_paths<C>( &self, source: &<Box<T> as NetworkGraphTraverse>::NodeId, destination: &<Box<T> as NetworkGraphTraverse>::NodeId, length: usize, take_count: Option<usize>, cost_fn: C, ) -> Vec<(Vec<<Box<T> as NetworkGraphTraverse>::NodeId>, [u64; 5], <C as CostFn>::Cost)>
where C: CostFn<Weight = <Box<T> as NetworkGraphTraverse>::Observed>,

§

fn simple_loopback_to_self( &self, length: usize, take_count: Option<usize>, ) -> Vec<(Vec<<Box<T> as NetworkGraphTraverse>::NodeId>, [u64; 5])>

§

impl<T> NetworkGraphTraverse for Arc<T>

§

type NodeId = <T as NetworkGraphTraverse>::NodeId

§

type Observed = <T as NetworkGraphTraverse>::Observed

§

fn simple_paths<C>( &self, source: &<Arc<T> as NetworkGraphTraverse>::NodeId, destination: &<Arc<T> as NetworkGraphTraverse>::NodeId, length: usize, take_count: Option<usize>, cost_fn: C, ) -> Vec<(Vec<<Arc<T> as NetworkGraphTraverse>::NodeId>, [u64; 5], <C as CostFn>::Cost)>
where C: CostFn<Weight = <Arc<T> as NetworkGraphTraverse>::Observed>,

§

fn simple_loopback_to_self( &self, length: usize, take_count: Option<usize>, ) -> Vec<(Vec<<Arc<T> as NetworkGraphTraverse>::NodeId>, [u64; 5])>

Implementors§