pub trait Topology<E> {
type Neighbors<'n>: Iterator<Item = (usize, E)>
where Self: 'n;
// Required methods
fn len(&self) -> usize;
fn neighbors(&self, vertex: usize) -> Self::Neighbors<'_>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn edge_cut(&self, partition: &[usize]) -> E
where Self: Sync,
E: Sum + Send { ... }
fn lambda_cut<W>(&self, partition: &[usize], weights: W) -> W::Item
where Self: Sync,
W: IntoParallelIterator,
W::Iter: IndexedParallelIterator,
W::Item: Sum + Mul<Output = W::Item> + FromPrimitive { ... }
}
Expand description
Topology
is implemented for types that represent mesh topology.
Required Associated Types§
sourcetype Neighbors<'n>: Iterator<Item = (usize, E)>
where
Self: 'n
type Neighbors<'n>: Iterator<Item = (usize, E)> where Self: 'n
Return type for Topology::neighbors
.
This is an implementation detail and will be removed when Rust allows us to do so (at most when async fns are allowed in traits).
Required Methods§
Provided Methods§
sourcefn edge_cut(&self, partition: &[usize]) -> Ewhere
Self: Sync,
E: Sum + Send,
fn edge_cut(&self, partition: &[usize]) -> Ewhere Self: Sync, E: Sum + Send,
The edge cut of a partition.
Given a partition and a weighted graph associated to a mesh, the edge cut of a partition is defined as the total weight of the edges that link graph nodes of different parts.
Example
A partition with two parts (0 and 1)
0
1*──┆─*────* 0
╱ ╲ ┆╱ ╱
1* 1*┆ <┈┈╱┈┈┈ Dotted line passes through edged that contribute to edge cut.
╲ ╱ ┆ ╱ If all edges have a weight of 1 then edge_cut = 3
1* ┆╲ ╱
* 0
sourcefn lambda_cut<W>(&self, partition: &[usize], weights: W) -> W::Itemwhere
Self: Sync,
W: IntoParallelIterator,
W::Iter: IndexedParallelIterator,
W::Item: Sum + Mul<Output = W::Item> + FromPrimitive,
fn lambda_cut<W>(&self, partition: &[usize], weights: W) -> W::Itemwhere Self: Sync, W: IntoParallelIterator, W::Iter: IndexedParallelIterator, W::Item: Sum + Mul<Output = W::Item> + FromPrimitive,
The λ-1 cut (lambda-1 cut) of a partition.
The λ-1 cut is the sum, for each vertex, of the number of different parts in its neighborhood times its communication weight.
This metric better represents the actual communication cost of a partition, albeit more expensive to compute.
Object Safety§
This trait is not object safe.