pub struct Graph<'g> { /* private fields */ }
Expand description
Equivalent of SCOTCH_Graph
.
Implementations§
source§impl<'g> Graph<'g>
impl<'g> Graph<'g>
sourcepub fn build(data: &Data<'g>) -> Result<Graph<'g>>
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
.
sourcepub fn from_stdin(baseval: Num) -> Result<Graph<'static>>
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
.
sourcepub fn from_file(path: impl AsRef<Path>, baseval: Num) -> Result<Graph<'static>>
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
.
sourcepub fn set_base(&mut self, baseval: Num) -> Num
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.
sourcepub fn check(&self) -> Result<()>
pub fn check(&self) -> Result<()>
Verify the integrity of the graph and returns an error iff the graph is invalid.
Equivalent of SCOTCH_graphCheck
.
sourcepub fn size(&self) -> (Num, Num)
pub fn size(&self) -> (Num, Num)
The number of vertices and edges in the graph.
Equivalent of SCOTCH_graphSize
.
sourcepub fn data(&self) -> Data<'_>
pub fn data(&self) -> Data<'_>
Underlying graph data.
The resulting vendtab
should always be non-empty?
Equivalent of SCOTCH_graphData
.
sourcepub fn mapping<'m>(
&'m mut self,
architecture: &'m Architecture,
parttab: &'m mut [Num]
) -> Mapping<'m, 'g>where
'g: 'm,
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.
sourcepub fn part_ovl(
&mut self,
num_parts: Num,
strategy: &mut Strategy,
parttab: &mut [Num]
) -> Result<()>
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.