Type Alias petgraph::adj::UnweightedList

source ·
pub type UnweightedList<Ix> = List<(), Ix>;
Expand description

A very simple adjacency list with no node or label weights.

Aliased Type§

struct UnweightedList<Ix> { /* private fields */ }

Implementations§

source§

impl<E, Ix: IndexType> List<E, Ix>

source

pub fn new() -> List<E, Ix>

Creates a new, empty adjacency list.

source

pub fn with_capacity(nodes: usize) -> List<E, Ix>

Creates a new, empty adjacency list tailored for nodes nodes.

source

pub fn clear(&mut self)

Removes all nodes and edges from the list.

source

pub fn edge_count(&self) -> usize

Returns the number of edges in the list

Computes in O(|V|) time.

source

pub fn add_node(&mut self) -> NodeIndex<Ix>

Adds a new node to the list. This allocates a new Vec and then should run in amortized O(1) time.

source

pub fn add_node_with_capacity(&mut self, successors: usize) -> NodeIndex<Ix>

Adds a new node to the list. This allocates a new Vec and then should run in amortized O(1) time.

source

pub fn add_node_from_edges<I: Iterator<Item = (NodeIndex<Ix>, E)>>( &mut self, edges: I ) -> NodeIndex<Ix>

Adds a new node to the list by giving its list of successors and the corresponding weigths.

source

pub fn add_edge( &mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E ) -> EdgeIndex<Ix>

Add an edge from a to b to the graph, with its associated data weight.

Return the index of the new edge.

Computes in O(1) time.

Panics if the source node does not exist.

Note: List allows adding parallel (“duplicate”) edges. If you want to avoid this, use .update_edge(a, b, weight) instead.

source

pub fn edge_endpoints( &self, e: EdgeIndex<Ix> ) -> Option<(NodeIndex<Ix>, NodeIndex<Ix>)>

Accesses the source and target of edge e

Computes in O(1)

source

pub fn edge_indices_from(&self, a: NodeIndex<Ix>) -> OutgoingEdgeIndices<Ix>

source

pub fn contains_edge(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> bool

Lookups whether there is an edge from a to b.

Computes in O(e’) time, where e’ is the number of successors of a.

source

pub fn find_edge( &self, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> Option<EdgeIndex<Ix>>

Lookups whether there is an edge from a to b.

Computes in O(e’) time, where e’ is the number of successors of a.

source

pub fn node_indices(&self) -> NodeIndices<Ix>

Returns an iterator over all node indices of the graph.

Consuming the whole iterator take O(|V|).

source

pub fn edge_indices(&self) -> EdgeIndices<'_, E, Ix>

Returns an iterator over all edge indices of the graph.

Consuming the whole iterator take O(|V| + |E|).

Trait Implementations§

source§

impl<E, Ix: IndexType> Build for List<E, Ix>

source§

fn add_node(&mut self, _weight: ()) -> NodeIndex<Ix>

Adds a new node to the list. This allocates a new Vec and then should run in amortized O(1) time.

source§

fn add_edge( &mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E ) -> Option<EdgeIndex<Ix>>

Add an edge from a to b to the graph, with its associated data weight.

Return the index of the new edge.

Computes in O(1) time.

Panics if the source node does not exist.

Note: List allows adding parallel (“duplicate”) edges. If you want to avoid this, use .update_edge(a, b, weight) instead.

source§

fn update_edge( &mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E ) -> EdgeIndex<Ix>

Updates or adds an edge from a to b to the graph, with its associated data weight.

Return the index of the new edge.

Computes in O(e’) time, where e’ is the number of successors of a.

Panics if the source node does not exist.

source§

impl<E: Clone, Ix> Clone for List<E, Ix>where Ix: IndexType + Clone,

source§

fn clone(&self) -> List<E, Ix>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<E, Ix: IndexType> Data for List<E, Ix>

source§

impl<E, Ix: IndexType> DataMap for List<E, Ix>

source§

fn edge_weight(&self, e: EdgeIndex<Ix>) -> Option<&E>

Accesses the weight of edge e

Computes in O(1)

source§

fn node_weight(&self, n: Self::NodeId) -> Option<&()>

source§

impl<E, Ix: IndexType> DataMapMut for List<E, Ix>

source§

fn edge_weight_mut(&mut self, e: EdgeIndex<Ix>) -> Option<&mut E>

Accesses the weight of edge e

Computes in O(1)

source§

fn node_weight_mut(&mut self, n: Self::NodeId) -> Option<&mut ()>

source§

impl<E, Ix> Debug for List<E, Ix>where E: Debug, Ix: IndexType,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Default, Ix> Default for List<E, Ix>where Ix: IndexType + Default,

source§

fn default() -> List<E, Ix>

Returns the “default value” for a type. Read more
source§

impl<E, Ix: IndexType> EdgeCount for List<E, Ix>

source§

fn edge_count(&self) -> usize

Returns the number of edges in the list

Computes in O(|V|) time.

source§

impl<E, Ix> GetAdjacencyMatrix for List<E, Ix>where Ix: IndexType,

The adjacency matrix for List is a bitmap that’s computed by .adjacency_matrix().

§

type AdjMatrix = FixedBitSet

The associated adjacency matrix type
source§

fn adjacency_matrix(&self) -> FixedBitSet

Create the adjacency matrix
source§

fn is_adjacent( &self, matrix: &FixedBitSet, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> bool

Return true if there is an edge from a to b, false otherwise. Read more
source§

impl<E, Ix> GraphBase for List<E, Ix>where Ix: IndexType,

§

type NodeId = Ix

node identifier
§

type EdgeId = EdgeIndex<Ix>

edge identifier
source§

impl<E, Ix: IndexType> GraphProp for List<E, Ix>

§

type EdgeType = Directed

The kind of edges in the graph.
source§

fn is_directed(&self) -> bool

source§

impl<E, Ix: IndexType> NodeCount for List<E, Ix>

source§

fn node_count(&self) -> usize

Returns the number of nodes in the list

Computes in O(1) time.

source§

impl<E, Ix: IndexType> NodeIndexable for List<E, Ix>

source§

fn node_bound(&self) -> usize

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

fn to_index(&self, a: Self::NodeId) -> usize

Convert a to an integer index.
source§

fn from_index(&self, i: usize) -> Self::NodeId

Convert i to a node index. i must be a valid value in the graph.
source§

impl<E, Ix> Visitable for List<E, Ix>where Ix: IndexType,

§

type Map = FixedBitSet

The associated map type
source§

fn visit_map(&self) -> FixedBitSet

Create a new visitor map
source§

fn reset_map(&self, map: &mut Self::Map)

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

impl<E, Ix: IndexType> NodeCompactIndexable for List<E, Ix>