Struct petgraph::csr::Csr [] [src]

pub struct Csr<N = (), E = (), Ty = Directed, Ix = DefaultIx> { /* fields omitted */ }

Compressed Sparse Row (CSR) is a sparse adjacency matrix graph.

Using O(|E| + |V|) space.

Self loops are allowed, no parallel edges.

Fast iteration of the outgoing edges of a vertex.

Methods

impl<N, E, Ty, Ix> Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

Create an empty Csr.

[src]

Create a new Csr with n nodes.

impl<N, E, Ix> Csr<N, E, Directed, Ix> where
    Ix: IndexType
[src]

[src]

Create a new Csr from a sorted sequence of edges

Edges must be sorted and unique, where the sort order is the default order for the pair (u, v) in Rust (u has priority).

Computes in O(|E| + |V|) time.

impl<N, E, Ty, Ix> Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

[src]

[src]

[src]

Remove all edges

[src]

Adds a new node with the given weight, returning the corresponding node index.

[src]

Return true if the edge was added

If you add all edges in row-major order, the time complexity is O(|V|·|E|) for the whole operation.

Panics if a or b are out of bounds.

[src]

Computes in O(log |V|) time.

Panics if the node a does not exist.

[src]

Computes in O(1) time.

Panics if the node a does not exist.

[src]

Computes in O(1) time.

Panics if the node a does not exist.

[src]

Computes in O(1) time.

Panics if the node a does not exist.

Important traits for Edges<'a, E, Ty, Ix>
[src]

Return an iterator of all edges of a.

  • Directed: Outgoing edges from a.
  • Undirected: All edges connected to a.

Panics if the node a does not exist.
Iterator element type is EdgeReference<E, Ty, Ix>.

Trait Implementations

impl<N: Debug, E: Debug, Ty: Debug, Ix: Debug> Debug for Csr<N, E, Ty, Ix>
[src]

[src]

Formats the value using the given formatter. Read more

impl<N, E, Ty, Ix> Default for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

Returns the "default value" for a type. Read more

impl<N: Clone, E: Clone, Ty, Ix: Clone> Clone for Csr<N, E, Ty, Ix>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<N, E, Ty, Ix> Data for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

impl<'a, N, E, Ty, Ix> IntoEdgeReferences for &'a Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

impl<'a, N, E, Ty, Ix> IntoEdges for &'a Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

impl<N, E, Ty, Ix> GraphBase for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

node identifier

edge identifier

impl<N, E, Ty, Ix> Visitable for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

The associated map type

[src]

Create a new visitor map

[src]

Reset the visitor map (and resize to new size of graph if needed)

impl<'a, N, E, Ty, Ix> IntoNeighbors for &'a Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

Return an iterator of all neighbors of a.

  • Directed: Targets of outgoing edges from a.
  • Undirected: Opposing endpoints of all edges connected to a.

Panics if the node a does not exist.
Iterator element type is NodeIndex<Ix>.

impl<N, E, Ty, Ix> NodeIndexable for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

Return an upper bound of the node indices in the graph (suitable for the size of a bitmap). Read more

[src]

Convert a to an integer index.

[src]

Convert i to a node index

impl<N, E, Ty, Ix> NodeCompactIndexable for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

impl<N, E, Ty, Ix> Index<NodeIndex<Ix>> for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<N, E, Ty, Ix> IndexMut<NodeIndex<Ix>> for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

Performs the mutable indexing (container[index]) operation.

impl<'a, N, E, Ty, Ix> IntoNodeIdentifiers for &'a Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

impl<N, E, Ty, Ix> NodeCount for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

[src]

impl<N, E, Ty, Ix> GraphProp for Csr<N, E, Ty, Ix> where
    Ty: EdgeType,
    Ix: IndexType
[src]

The kind edges in the graph.

[src]