Struct scotch::graph::Graph

source ·
pub struct Graph<'g> { /* private fields */ }
Expand description

Equivalent of SCOTCH_Graph.

Implementations§

source§

impl<'g> Graph<'g>

source

pub fn build(data: &Data<'g>) -> Result<Graph<'g>>

Make a new graph from the given data.

During development stage, it is recommended to call Graph::check after calling this function, to ensure graph data is consistent.

Equivalent of SCOTCH_graphBuild.

source

pub fn from_stdin(baseval: Num) -> Result<Graph<'static>>

Build a Graph from the data found in standard input.

This function closes standard input.

Convenience wrapper around SCOTCH_graphLoad.

source

pub fn from_file(path: impl AsRef<Path>, baseval: Num) -> Result<Graph<'static>>

Build a Graph from the data found in the given file.

Convenience wrapper around SCOTCH_graphLoad.

source

pub fn set_base(&mut self, baseval: Num) -> Num

Set the baseval and retrieve its old value.

Equivalent of SCOTCH_graphBase.

Panics

This function panics iff baseval is neither 0 nor 1.

source

pub fn check(&self) -> Result<()>

Verify the integrity of the graph and returns an error iff the graph is invalid.

Equivalent of SCOTCH_graphCheck.

source

pub fn size(&self) -> (Num, Num)

The number of vertices and edges in the graph.

Equivalent of SCOTCH_graphSize.

source

pub fn data(&self) -> Data<'_>

Underlying graph data.

The resulting vendtab should always be non-empty?

Equivalent of SCOTCH_graphData.

source

pub fn mapping<'m>( &'m mut self, architecture: &'m Architecture, parttab: &'m mut [Num] ) -> Mapping<'m, 'g>where 'g: 'm,

Create a Mapping between this graph and the given Architecture.

Equivalent of SCOTCH_graphMapInit.

Panics

This function panics if the length of parttab is not equal to the number of vertices in the graph.

Mutability

While this function doesn’t modify the graph, Scotch doesn’t specify the const modifier and the Rust borrow must be mutable.

source

pub fn part_ovl( &mut self, num_parts: Num, strategy: &mut Strategy, parttab: &mut [Num] ) -> Result<()>

Compute a partition with overlap of the given graph structure with respect to the given strategy.

Equivalent of SCOTCH_graphPartOvl.

Panics

This function panics if the length of parttab is lower than the number of vertices.

Errors

This function returns an error in the following cases:

  • the strategy isn’t made for overlap partitioning (the caller hasn’t previously called Strategy::graph_part_ovl,
  • the strategy fails to apply,
  • Scotch encounters an out of memory error,
  • Scotch encounters an internal error.
Mutability

While this function modifies neither the graph nor the strategy, Scotch doesn’t specify any const modifier and the Rust borrows must be mutable.

Trait Implementations§

source§

impl Drop for Graph<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'g> RefUnwindSafe for Graph<'g>

§

impl<'g> Send for Graph<'g>

§

impl<'g> Sync for Graph<'g>

§

impl<'g> Unpin for Graph<'g>

§

impl<'g> UnwindSafe for Graph<'g>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.