pub struct CsrGraph {
pub num_nodes: usize,
pub num_edges: usize,
pub row_offsets: Vec<u64>,
pub col_indices: Vec<u64>,
pub weights: Option<Vec<f32>>,
}Expand description
Graph representation in Compressed Sparse Row (CSR) format.
Efficient for GPU processing with coalesced memory access.
Fields§
§num_nodes: usizeNumber of nodes.
num_edges: usizeNumber of edges.
row_offsets: Vec<u64>Row offsets (length: num_nodes + 1).
col_indices: Vec<u64>Column indices (length: num_edges).
weights: Option<Vec<f32>>Edge weights (optional, length: num_edges).
Implementations§
Source§impl CsrGraph
impl CsrGraph
Sourcepub fn from_edges(num_nodes: usize, edges: &[(u64, u64)]) -> Self
pub fn from_edges(num_nodes: usize, edges: &[(u64, u64)]) -> Self
Create a graph from edge list.
Sourcepub fn out_degree(&self, node: u64) -> u64
pub fn out_degree(&self, node: u64) -> u64
Get the out-degree of a node.
Sourcepub fn is_weighted(&self) -> bool
pub fn is_weighted(&self) -> bool
Check if the graph has weights.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CsrGraph
impl<'de> Deserialize<'de> for CsrGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CsrGraph
impl RefUnwindSafe for CsrGraph
impl Send for CsrGraph
impl Sync for CsrGraph
impl Unpin for CsrGraph
impl UnwindSafe for CsrGraph
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.