Trait Edge

Source
pub trait Edge: Display {
    // Required methods
    fn direction(&self) -> EdgeDirection;
    fn lhs(&self) -> usize;
    fn rhs(&self) -> usize;

    // Provided methods
    fn max_index(&self) -> usize { ... }
    fn min_index(&self) -> usize { ... }
    fn delta_index(&self) -> usize { ... }
}
Expand description

Marker trait for edges

§Examples

use graph_theory::GraphEngine;

Required Methods§

Source

fn direction(&self) -> EdgeDirection

Whether the edge is bidirectional

§Examples
use graph_theory::DirectedEdge;
Source

fn lhs(&self) -> usize

The left side node id of the edge

§Examples
use graph_theory::GraphEngine;
Source

fn rhs(&self) -> usize

The right side node id of the edge

§Examples
use graph_theory::GraphEngine;

Provided Methods§

Source

fn max_index(&self) -> usize

The smaller of the two indices.

§Examples
use graph_theory::{Edge, UndirectedEdge};
assert_eq!(UndirectedEdge::new(1, 2).max_index(), 2);
assert_eq!(UndirectedEdge::new(2, 1).max_index(), 2);
Source

fn min_index(&self) -> usize

The smaller of the two indices.

§Examples
use graph_theory::{Edge, UndirectedEdge};
assert_eq!(UndirectedEdge::new(1, 2).min_index(), 1);
assert_eq!(UndirectedEdge::new(2, 1).min_index(), 1);
Source

fn delta_index(&self) -> usize

The smaller of the two indices.

§Examples
use graph_theory::{Edge, UndirectedEdge};
assert_eq!(UndirectedEdge::new(1, 3).delta_index(), 2);
assert_eq!(UndirectedEdge::new(3, 1).delta_index(), 2);

Implementors§