Trait graph_types::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 { ... }
fn as_dynamic(&self) -> DynamicEdge { ... }
}
Expand description
Required Methods§
Provided Methods§
sourcefn max_index(&self) -> usize
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);
sourcefn min_index(&self) -> usize
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);
sourcefn delta_index(&self) -> usize
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);
sourcefn as_dynamic(&self) -> DynamicEdge
fn as_dynamic(&self) -> DynamicEdge
Creates a new edge with the indices swapped.