Skip to main content

DirectedCsrGraph

Struct DirectedCsrGraph 

Source
pub struct DirectedCsrGraph<NI: Idx, NV = (), EV = ()> { /* private fields */ }

Implementations§

Source§

impl<NI: Idx, NV, EV> DirectedCsrGraph<NI, NV, EV>

Source

pub fn new( node_values: NodeValues<NV>, csr_out: Csr<NI, NI, EV>, csr_inc: Csr<NI, NI, EV>, ) -> Self

Trait Implementations§

Source§

impl<R, NI, NV, EV> DeserializeGraphOp<R, DirectedCsrGraph<NI, NV, EV>> for DirectedCsrGraph<NI, NV, EV>

Source§

fn deserialize(read: R) -> Result<Self, Error>

Source§

impl<NI: Idx, NV, EV> DirectedDegrees<NI> for DirectedCsrGraph<NI, NV, EV>

Source§

fn out_degree(&self, node: NI) -> NI

Returns the number of edges where the given node is a source node.
Source§

fn in_degree(&self, node: NI) -> NI

Returns the number of edges where the given node is a target node.
Source§

impl<NI: Idx, NV> DirectedNeighbors<NI> for DirectedCsrGraph<NI, NV, ()>

Source§

type NeighborsIterator<'a> = Iter<'a, NI> where NV: 'a

Source§

fn out_neighbors(&self, node: NI) -> Self::NeighborsIterator<'_>

Returns an iterator of all nodes which are connected in outgoing direction to the given node, i.e., the given node is the source node of the connecting edge.
Source§

fn in_neighbors(&self, node: NI) -> Self::NeighborsIterator<'_>

Returns an iterator of all nodes which are connected in incoming direction to the given node, i.e., the given node is the target node of the connecting edge.
Source§

impl<NI: Idx, NV, EV> DirectedNeighborsWithValues<NI, EV> for DirectedCsrGraph<NI, NV, EV>

Source§

type NeighborsIterator<'a> = Iter<'a, Target<NI, EV>> where NV: 'a, EV: 'a

Source§

fn out_neighbors_with_values(&self, node: NI) -> Self::NeighborsIterator<'_>

Returns an iterator of all nodes which are connected in outgoing direction to the given node, i.e., the given node is the source node of the connecting edge. For each connected node, the value of the connecting edge is also returned.
Source§

fn in_neighbors_with_values(&self, node: NI) -> Self::NeighborsIterator<'_>

Returns an iterator of all nodes which are connected in incoming direction to the given node, i.e., the given node is the target node of the connecting edge. For each connected node, the value of the connecting edge is also returned.
Source§

impl<'a, NI, NV, EV> From<(&'a Graph, CsrLayout)> for DirectedCsrGraph<NI, NV, EV>
where NI: Idx, NV: From<MyCypherValue<'a>> + Default + Copy + Send + Sync, EV: From<MyCypherValue<'a>> + Default + Copy + Send + Sync,

Available on crate feature gdl only.
Source§

fn from((gdl_graph, csr_layout): (&'a Graph, CsrLayout)) -> Self

Converts to this type from the input type.
Source§

impl<NI, Label> From<(DotGraph<NI, Label>, CsrLayout)> for DirectedCsrGraph<NI, ()>
where NI: Idx, Label: Idx + Hash,

Available on crate feature dotgraph only.
Source§

fn from((dot_graph, csr_layout): (DotGraph<NI, Label>, CsrLayout)) -> Self

Converts to this type from the input type.
Source§

impl<NI, Label> From<(DotGraph<NI, Label>, CsrLayout)> for DirectedCsrGraph<NI, Label>
where NI: Idx, Label: Idx + Hash,

Available on crate feature dotgraph only.
Source§

fn from((dot_graph, csr_layout): (DotGraph<NI, Label>, CsrLayout)) -> Self

Converts to this type from the input type.
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>,

Source§

fn from((edge_list, csr_option): (E, CsrLayout)) -> Self

Converts to this type from the input type.
Source§

impl<NI, NV, EV> From<(Graph, CsrLayout)> for DirectedCsrGraph<NI, NV, EV>
where NI: Idx, for<'a> NV: From<MyCypherValue<'a>> + Default + Copy + Send + Sync, for<'a> EV: From<MyCypherValue<'a>> + Default + Copy + Send + Sync,

Available on crate feature gdl only.
Source§

fn from((gdl_graph, csr_layout): (Graph, CsrLayout)) -> Self

Converts to this type from the input type.
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>,

Source§

fn from( (node_values, edge_list, csr_option): (NodeValues<NV>, E, CsrLayout), ) -> Self

Converts to this type from the input type.
Source§

impl<NI: Idx, NV, EV> Graph<NI> for DirectedCsrGraph<NI, NV, EV>

Source§

fn node_count(&self) -> NI

Returns the number of nodes in the graph.
Source§

fn edge_count(&self) -> NI

Returns the number of edges in the graph.
Source§

impl<NI: Idx, NV, EV> NodeValues<NI, NV> for DirectedCsrGraph<NI, NV, EV>

Source§

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,

Source§

fn serialize(&self, output: W) -> Result<(), Error>

Source§

impl<NI, NV, EV> ToUndirectedOp for DirectedCsrGraph<NI, NV, EV>
where NI: Idx, NV: Clone + Send + Sync, EV: Copy + Send + Sync,

Source§

type Undirected = UndirectedCsrGraph<NI, NV, EV>

Source§

fn to_undirected( &self, layout: impl Into<Option<CsrLayout>>, ) -> Self::Undirected

Creates a new undirected graph from the edges of an existing graph. Read more
Source§

impl<NI, EV> TryFrom<(PathBuf, CsrLayout)> for DirectedCsrGraph<NI, EV>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from((path, _): (PathBuf, CsrLayout)) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<NI, NV, EV> Freeze for DirectedCsrGraph<NI, NV, EV>

§

impl<NI, NV, EV> RefUnwindSafe for DirectedCsrGraph<NI, NV, EV>

§

impl<NI, NV, EV> Send for DirectedCsrGraph<NI, NV, EV>
where NV: Send, EV: Send,

§

impl<NI, NV, EV> Sync for DirectedCsrGraph<NI, NV, EV>
where NV: Sync, EV: Sync,

§

impl<NI, NV, EV> Unpin for DirectedCsrGraph<NI, NV, EV>

§

impl<NI, NV, EV> UnsafeUnpin for DirectedCsrGraph<NI, NV, EV>

§

impl<NI, NV, EV> UnwindSafe for DirectedCsrGraph<NI, NV, EV>
where NV: UnwindSafe, NI: UnwindSafe, EV: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<NI, G> ForEachNodeParallelByPartitionOp<NI> for G
where 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,

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 G
where 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,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<NI, EV, D> InDegreePartitionOp<NI, EV> for D
where NI: Idx, D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,

Source§

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<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<NI, EV, D> OutDegreePartitionOp<NI, EV> for D
where NI: Idx, D: Graph<NI> + DirectedDegrees<NI> + DirectedNeighborsWithValues<NI, EV>,

Source§

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);
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.