oxiblas_sparse/graph/types.rs
1//! Auto-generated module
2//!
3//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
4
5/// Result of bipartite check.
6#[derive(Debug, Clone)]
7pub struct BipartiteResult {
8 /// Whether the graph is bipartite.
9 pub is_bipartite: bool,
10 /// Partition assignment for each vertex (0 or 1).
11 /// Only valid if `is_bipartite` is true.
12 pub partition: Vec<usize>,
13 /// Vertices in partition 0.
14 pub left: Vec<usize>,
15 /// Vertices in partition 1.
16 pub right: Vec<usize>,
17}
18/// Result of graph partitioning.
19#[derive(Debug, Clone)]
20pub struct PartitionResult {
21 /// Partition assignment for each vertex (0 to k-1 for k-way partitioning).
22 pub partition: Vec<usize>,
23 /// Number of partitions.
24 pub num_partitions: usize,
25 /// Size of each partition (number of vertices).
26 pub partition_sizes: Vec<usize>,
27 /// Edge cut size (number of edges crossing partitions).
28 pub edge_cut: usize,
29}
30/// Result of bandwidth and profile analysis.
31#[derive(Debug, Clone)]
32pub struct BandwidthProfileResult {
33 /// Bandwidth: max |i - j| for all non-zero a_ij.
34 pub bandwidth: usize,
35 /// Lower bandwidth: max (i - j) for all non-zero a_ij where i > j.
36 pub lower_bandwidth: usize,
37 /// Upper bandwidth: max (j - i) for all non-zero a_ij where j > i.
38 pub upper_bandwidth: usize,
39 /// Profile (envelope): sum of row bandwidths.
40 pub profile: usize,
41 /// Average bandwidth per row.
42 pub average_bandwidth: f64,
43}
44/// Result of level set construction.
45#[derive(Debug, Clone)]
46pub struct LevelSetResult {
47 /// Level (distance from root) for each vertex.
48 pub levels: Vec<usize>,
49 /// List of vertices at each level.
50 pub level_sets: Vec<Vec<usize>>,
51 /// Maximum level (eccentricity of root).
52 pub max_level: usize,
53}
54/// Result of bipartite matching.
55#[derive(Debug, Clone)]
56pub struct BipartiteMatchingResult {
57 /// For each vertex in left partition, the matched vertex in right partition.
58 /// `None` if the vertex is unmatched.
59 pub left_match: Vec<Option<usize>>,
60 /// For each vertex in right partition, the matched vertex in left partition.
61 /// `None` if the vertex is unmatched.
62 pub right_match: Vec<Option<usize>>,
63 /// Size of the maximum matching (number of edges).
64 pub matching_size: usize,
65 /// List of edges in the matching as (left_vertex, right_vertex) pairs.
66 pub edges: Vec<(usize, usize)>,
67 /// Whether a perfect matching exists (all vertices matched).
68 pub is_perfect: bool,
69}
70/// Result of weighted bipartite matching.
71#[derive(Debug, Clone)]
72pub struct WeightedMatchingResult<T> {
73 /// For each vertex in left partition, the matched vertex in right partition.
74 pub left_match: Vec<Option<usize>>,
75 /// For each vertex in right partition, the matched vertex in left partition.
76 pub right_match: Vec<Option<usize>>,
77 /// Size of the maximum matching.
78 pub matching_size: usize,
79 /// List of edges in the matching.
80 pub edges: Vec<(usize, usize)>,
81 /// Total weight of the matching.
82 pub total_weight: T,
83}
84/// Result of connected components analysis.
85#[derive(Debug, Clone)]
86pub struct ConnectedComponentsResult {
87 /// Component label for each vertex (0-indexed).
88 pub labels: Vec<usize>,
89 /// Number of connected components.
90 pub num_components: usize,
91 /// Size of each component.
92 pub component_sizes: Vec<usize>,
93}