pub struct CsrGraph<'a> {
pub node_count: u32,
pub edge_offsets: &'a [u32],
pub edge_targets: &'a [u32],
pub edge_kind_mask: &'a [u32],
}Expand description
Borrowed CSR graph view shared by Weir analyses.
Fields§
§node_count: u32Number of graph nodes in the analysis domain.
edge_offsets: &'a [u32]CSR row offsets, length node_count + 1.
edge_targets: &'a [u32]CSR edge targets.
edge_kind_mask: &'a [u32]CSR edge-kind masks, length equal to edge_targets.
Implementations§
Source§impl<'a> CsrGraph<'a>
impl<'a> CsrGraph<'a>
Sourcepub fn new(
node_count: u32,
edge_offsets: &'a [u32],
edge_targets: &'a [u32],
edge_kind_mask: &'a [u32],
) -> Self
pub fn new( node_count: u32, edge_offsets: &'a [u32], edge_targets: &'a [u32], edge_kind_mask: &'a [u32], ) -> Self
Build a borrowed CSR graph view.
Sourcepub fn validate(self, stage: &str) -> Result<Self, String>
pub fn validate(self, stage: &str) -> Result<Self, String>
Validate this graph against the shared Weir CSR ABI.
Sourcepub fn normalize(self, stage: &str) -> Result<NormalizedCsrGraph, String>
pub fn normalize(self, stage: &str) -> Result<NormalizedCsrGraph, String>
Validate and canonicalize rows into sorted, duplicate-free edge order.
Sourcepub fn normalize_with_edge_kind_mask(
self,
stage: &str,
allowed_mask: u32,
) -> Result<NormalizedCsrGraph, String>
pub fn normalize_with_edge_kind_mask( self, stage: &str, allowed_mask: u32, ) -> Result<NormalizedCsrGraph, String>
Validate and canonicalize rows after masking each edge-kind word.
This avoids analysis-local temporary Vec<u32> filters before graph
normalization. Analyses such as points-to can keep a single shared CSR
contract while applying their allowed-edge predicate during packing.
Sourcepub fn normalize_into(
self,
stage: &str,
output: &mut NormalizedCsrGraph,
scratch: &mut CsrGraphNormalizationScratch,
) -> Result<(), String>
pub fn normalize_into( self, stage: &str, output: &mut NormalizedCsrGraph, scratch: &mut CsrGraphNormalizationScratch, ) -> Result<(), String>
Validate and canonicalize rows into caller-owned output and scratch.
Sourcepub fn normalize_with_edge_kind_mask_into(
self,
stage: &str,
allowed_mask: u32,
output: &mut NormalizedCsrGraph,
scratch: &mut CsrGraphNormalizationScratch,
) -> Result<(), String>
pub fn normalize_with_edge_kind_mask_into( self, stage: &str, allowed_mask: u32, output: &mut NormalizedCsrGraph, scratch: &mut CsrGraphNormalizationScratch, ) -> Result<(), String>
Validate and canonicalize rows after masking into caller-owned buffers.