pub struct Graph {
pub adjacency: Vec<Vec<PointId>>,
pub degree: Vec<usize>,
pub p_min_degree: usize,
pub p_max_degree: usize,
/* private fields */
}
Expand description
Defines a graph structure to assist in renumbering a mesh
Fields§
§adjacency: Vec<Vec<PointId>>
Holds the adjacency (sparse) matrix (point connections)
Note: each row in this matrix is sorted in ascending order of degree, followed by id
degree: Vec<usize>
Holds all point degrees (the number of connections of a vertex)
p_min_degree: usize
Holds the id of the point with the minimum degree
p_max_degree: usize
Holds the id of the point with the maximum degree
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn cuthill_mckee(
&mut self,
start_point: Option<PointId>,
) -> Result<Vec<PointId>, StrError>
pub fn cuthill_mckee( &mut self, start_point: Option<PointId>, ) -> Result<Vec<PointId>, StrError>
Computes the ordering array to renumber the vertices according to the (reverse) Cuthill-McKee algorithm
Note: All nodes must be reachable from the root; i.e., the corresponding graph must be connected.
§Input
start_point
– (root) the first point id, which will not be renumbered. Should have a low degree. If None, a pseudo-peripheral point is determined and used as root.
§Output
Returns the ordering array such that old = ordering[new]
where old
is the original
point id and new
is the new point id. See the function Graph::get_old_to_new_map
Sourcepub fn calc_distance(&mut self, root: usize) -> usize
pub fn calc_distance(&mut self, root: usize) -> usize
Sourcepub fn pseudo_peripheral(&mut self, start_point: Option<PointId>) -> usize
pub fn pseudo_peripheral(&mut self, start_point: Option<PointId>) -> usize
Finds a pseudo-peripheral point
§Input
start_point
– (root) the first point id, which will not be renumbered. Should have a low degree. If None, a point with a minimum degree will be used.
Sourcepub fn calc_bandwidth(&self) -> usize
pub fn calc_bandwidth(&self) -> usize
Calculates the (half) bandwidth (with diagonal) of the adjacency matrix
band = max{band_i, 0 ≤ n ≤ npoint-1}
band_i = max{|i - j| + 1, any j > i}
Sourcepub fn print_non_zero_pattern(&self)
pub fn print_non_zero_pattern(&self)
Prints the non-zero pattern of the laplacian matrix
L = D - A
L: Laplacian matrix
A: Adjacency matrix
D: Diagonal matrix with the degrees