Struct graph::prelude::DirectedCsrGraph
source · pub struct DirectedCsrGraph<NI, NV = (), EV = ()>where
NI: Idx,{ /* private fields */ }
Implementations§
source§impl<NI, NV, EV> DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
impl<NI, NV, EV> DirectedCsrGraph<NI, NV, EV>where NI: Idx,
pub fn new( node_values: NodeValues<NV>, csr_out: Csr<NI, NI, EV>, csr_inc: Csr<NI, NI, EV> ) -> DirectedCsrGraph<NI, NV, EV>
Trait Implementations§
source§impl<R, NI, NV, EV> DeserializeGraphOp<R, DirectedCsrGraph<NI, NV, EV>> for DirectedCsrGraph<NI, NV, EV>where
R: Read,
NI: Idx + ToMutByteSlice,
NV: ToMutByteSlice,
EV: ToMutByteSlice,
impl<R, NI, NV, EV> DeserializeGraphOp<R, DirectedCsrGraph<NI, NV, EV>> for DirectedCsrGraph<NI, NV, EV>where R: Read, NI: Idx + ToMutByteSlice, NV: ToMutByteSlice, EV: ToMutByteSlice,
fn deserialize(read: R) -> Result<DirectedCsrGraph<NI, NV, EV>, Error>
source§impl<NI, NV, EV> DirectedDegrees<NI> for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
impl<NI, NV, EV> DirectedDegrees<NI> for DirectedCsrGraph<NI, NV, EV>where NI: Idx,
source§impl<NI, NV> DirectedNeighbors<NI> for DirectedCsrGraph<NI, NV>where
NI: Idx,
impl<NI, NV> DirectedNeighbors<NI> for DirectedCsrGraph<NI, NV>where NI: Idx,
type NeighborsIterator<'a> = Iter<'a, NI> where NV: 'a
source§fn out_neighbors(
&self,
node: NI
) -> <DirectedCsrGraph<NI, NV> as DirectedNeighbors<NI>>::NeighborsIterator<'_>
fn out_neighbors( &self, node: NI ) -> <DirectedCsrGraph<NI, NV> as DirectedNeighbors<NI>>::NeighborsIterator<'_>
source§fn in_neighbors(
&self,
node: NI
) -> <DirectedCsrGraph<NI, NV> as DirectedNeighbors<NI>>::NeighborsIterator<'_>
fn in_neighbors( &self, node: NI ) -> <DirectedCsrGraph<NI, NV> as DirectedNeighbors<NI>>::NeighborsIterator<'_>
source§impl<NI, NV, EV> DirectedNeighborsWithValues<NI, EV> for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
impl<NI, NV, EV> DirectedNeighborsWithValues<NI, EV> for DirectedCsrGraph<NI, NV, EV>where NI: Idx,
type NeighborsIterator<'a> = Iter<'a, Target<NI, EV>> where NV: 'a, EV: 'a
source§fn out_neighbors_with_values(
&self,
node: NI
) -> <DirectedCsrGraph<NI, NV, EV> as DirectedNeighborsWithValues<NI, EV>>::NeighborsIterator<'_>
fn out_neighbors_with_values( &self, node: NI ) -> <DirectedCsrGraph<NI, NV, EV> as DirectedNeighborsWithValues<NI, EV>>::NeighborsIterator<'_>
source§fn in_neighbors_with_values(
&self,
node: NI
) -> <DirectedCsrGraph<NI, NV, EV> as DirectedNeighborsWithValues<NI, EV>>::NeighborsIterator<'_>
fn in_neighbors_with_values( &self, node: NI ) -> <DirectedCsrGraph<NI, NV, EV> as DirectedNeighborsWithValues<NI, EV>>::NeighborsIterator<'_>
source§impl<NI, EV, E> From<(E, CsrLayout)> for DirectedCsrGraph<NI, (), EV>where
NI: Idx,
EV: Copy + Send + Sync,
E: Edges<NI = NI, EV = EV>,
impl<NI, EV, E> From<(E, CsrLayout)> for DirectedCsrGraph<NI, (), EV>where NI: Idx, EV: Copy + Send + Sync, E: Edges<NI = NI, EV = EV>,
source§impl<NI, NV, EV, E> From<(NodeValues<NV>, E, CsrLayout)> for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
EV: Copy + Send + Sync,
E: Edges<NI = NI, EV = EV>,
impl<NI, NV, EV, E> From<(NodeValues<NV>, E, CsrLayout)> for DirectedCsrGraph<NI, NV, EV>where NI: Idx, EV: Copy + Send + Sync, E: Edges<NI = NI, EV = EV>,
source§fn from(_: (NodeValues<NV>, E, CsrLayout)) -> DirectedCsrGraph<NI, NV, EV>
fn from(_: (NodeValues<NV>, E, CsrLayout)) -> DirectedCsrGraph<NI, NV, EV>
source§impl<NI, NV, EV> Graph<NI> for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
impl<NI, NV, EV> Graph<NI> for DirectedCsrGraph<NI, NV, EV>where NI: Idx,
source§fn node_count(&self) -> NI
fn node_count(&self) -> NI
source§fn edge_count(&self) -> NI
fn edge_count(&self) -> NI
source§impl<NI, NV, EV> NodeValues<NI, NV> for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
impl<NI, NV, EV> NodeValues<NI, NV> for DirectedCsrGraph<NI, NV, EV>where NI: Idx,
fn node_value(&self, node: NI) -> &NV
source§impl<W, NI, NV, EV> SerializeGraphOp<W> for DirectedCsrGraph<NI, NV, EV>where
W: Write,
NI: Idx + ToByteSlice,
NV: ToByteSlice,
EV: ToByteSlice,
impl<W, NI, NV, EV> SerializeGraphOp<W> for DirectedCsrGraph<NI, NV, EV>where W: Write, NI: Idx + ToByteSlice, NV: ToByteSlice, EV: ToByteSlice,
source§impl<NI, NV, EV> ToUndirectedOp for DirectedCsrGraph<NI, NV, EV>where
NI: Idx,
NV: Clone + Send + Sync,
EV: Copy + Send + Sync,
impl<NI, NV, EV> ToUndirectedOp for DirectedCsrGraph<NI, NV, EV>where NI: Idx, NV: Clone + Send + Sync, EV: Copy + Send + Sync,
type Undirected = UndirectedCsrGraph<NI, NV, EV>
source§fn to_undirected(
&self,
layout: impl Into<Option<CsrLayout>>
) -> <DirectedCsrGraph<NI, NV, EV> as ToUndirectedOp>::Undirected
fn to_undirected( &self, layout: impl Into<Option<CsrLayout>> ) -> <DirectedCsrGraph<NI, NV, EV> as ToUndirectedOp>::Undirected
Auto Trait Implementations§
impl<NI, NV, EV> RefUnwindSafe for DirectedCsrGraph<NI, NV, EV>where EV: RefUnwindSafe, NI: RefUnwindSafe, NV: RefUnwindSafe,
impl<NI, NV, EV> Send for DirectedCsrGraph<NI, NV, EV>where EV: Send, NV: Send,
impl<NI, NV, EV> Sync for DirectedCsrGraph<NI, NV, EV>where EV: Sync, NV: Sync,
impl<NI, NV, EV> Unpin for DirectedCsrGraph<NI, NV, EV>
impl<NI, NV, EV> UnwindSafe for DirectedCsrGraph<NI, NV, EV>where EV: UnwindSafe, NI: UnwindSafe, NV: UnwindSafe,
Blanket Implementations§
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
source§impl<NI, G> ForEachNodeParallelByPartitionOp<NI> for Gwhere
NI: Idx,
G: Graph<NI> + Sync,
impl<NI, G> ForEachNodeParallelByPartitionOp<NI> for Gwhere NI: Idx, G: Graph<NI> + Sync,
source§fn for_each_node_par_by_partition<T, F>(
&self,
partition: &[Range<NI>],
node_values: &mut [T],
node_fn: F
) -> Result<(), Error>where
T: Send,
F: Fn(&G, NI, &mut T) + Send + Sync,
fn for_each_node_par_by_partition<T, F>( &self, partition: &[Range<NI>], node_values: &mut [T], node_fn: F ) -> Result<(), Error>where T: Send, F: Fn(&G, NI, &mut T) + Send + Sync,
For each node calls a given function with the node and its corresponding mutable state in parallel based on the provided node partition.
The parallelization is done by means of a rayon based fork join with a task for each range in the provided node partition.
source§impl<NI, G> ForEachNodeParallelOp<NI> for Gwhere
NI: Idx,
G: Graph<NI> + Sync,
impl<NI, G> ForEachNodeParallelOp<NI> for Gwhere NI: Idx, G: Graph<NI> + Sync,
source§fn for_each_node_par<T, F>(
&self,
node_values: &mut [T],
node_fn: F
) -> Result<(), Error>where
T: Send,
F: Fn(&G, NI, &mut T) + Send + Sync,
fn for_each_node_par<T, F>( &self, node_values: &mut [T], node_fn: F ) -> Result<(), Error>where T: Send, F: Fn(&G, NI, &mut T) + Send + Sync,
For each node calls a given function with the node and its corresponding mutable state in parallel.
The parallelization is done by means of a rayon based fork join with a task for each node.
source§impl<NI, EV, D> InDegreePartitionOp<NI, EV> for Dwhere
NI: Idx,
D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,
impl<NI, EV, D> InDegreePartitionOp<NI, EV> for Dwhere NI: Idx, D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,
source§fn in_degree_partition(&self, concurrency: usize) -> Vec<Range<NI>>
fn in_degree_partition(&self, concurrency: usize) -> Vec<Range<NI>>
Creates a greedy range-based in degree partition of the nodes.
It is greedy in the sense that it goes through the node set only once and simply adds a new range to the result whenever the current range’s nodes’ in degrees sum up to at least the average node in degree.
Example
let graph: DirectedCsrGraph<u32> = GraphBuilder::new()
.edges(vec![(1, 0), (1, 2), (2, 0), (3, 2)])
.build();
let partition: Vec<Range<u32>> = graph.in_degree_partition(2);
assert_eq!(partition.len(), 2);
assert_eq!(partition[0], 0..1);
assert_eq!(partition[1], 1..4);
source§impl<NI, EV, D> OutDegreePartitionOp<NI, EV> for Dwhere
NI: Idx,
D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,
impl<NI, EV, D> OutDegreePartitionOp<NI, EV> for Dwhere NI: Idx, D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,
source§fn out_degree_partition(&self, concurrency: usize) -> Vec<Range<NI>>
fn out_degree_partition(&self, concurrency: usize) -> Vec<Range<NI>>
Creates a greedy range-based out degree partition of the nodes.
It is greedy in the sense that it goes through the node set only once and simply adds a new range to the result whenever the current range’s nodes’ out degrees sum up to at least the average node out degree.
Example
let graph: DirectedCsrGraph<u32> = GraphBuilder::new()
.edges(vec![(0, 1), (0, 2), (2, 1), (2, 3)])
.build();
let partition: Vec<Range<u32>> = graph.out_degree_partition(2);
assert_eq!(partition.len(), 2);
assert_eq!(partition[0], 0..1);
assert_eq!(partition[1], 1..4);