`pub type StableDiGraph<N, E, Ix = u32> = StableGraph<N, E, Directed, Ix>;`

## Expand description

A `StableGraph`

with directed edges.

For example, an edge from *1* to *2* is distinct from an edge from *2* to
*1*.

## Aliased Type§

`struct StableDiGraph<N, E, Ix = u32> { /* private fields */ }`

## Implementations§

source§### impl<N, E> StableGraph<N, E, Directed, u32>

### impl<N, E> StableGraph<N, E, Directed, u32>

source#### pub fn new() -> StableGraph<N, E, Directed, u32>

#### pub fn new() -> StableGraph<N, E, Directed, u32>

Create a new `StableGraph`

with directed edges.

This is a convenience method. See `StableGraph::with_capacity`

or `StableGraph::default`

for a constructor that is generic in all the
type parameters of `StableGraph`

.

source§### impl<N, E, Ty, Ix> StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

source#### pub fn with_capacity(nodes: usize, edges: usize) -> StableGraph<N, E, Ty, Ix>

#### pub fn with_capacity(nodes: usize, edges: usize) -> StableGraph<N, E, Ty, Ix>

Create a new `StableGraph`

with estimated capacity.

source#### pub fn capacity(&self) -> (usize, usize)

#### pub fn capacity(&self) -> (usize, usize)

Return the current node and edge capacity of the graph.

source#### pub fn clear_edges(&mut self)

#### pub fn clear_edges(&mut self)

Remove all edges

source#### pub fn node_count(&self) -> usize

#### pub fn node_count(&self) -> usize

Return the number of nodes (vertices) in the graph.

Computes in **O(1)** time.

source#### pub fn edge_count(&self) -> usize

#### pub fn edge_count(&self) -> usize

Return the number of edges in the graph.

Computes in **O(1)** time.

source#### pub fn is_directed(&self) -> bool

#### pub fn is_directed(&self) -> bool

Whether the graph has directed edges or not.

source#### pub fn add_node(&mut self, weight: N) -> NodeIndex<Ix>

#### pub fn add_node(&mut self, weight: N) -> NodeIndex<Ix>

Add a node (also called vertex) with associated data `weight`

to the graph.

Computes in **O(1)** time.

Return the index of the new node.

**Panics** if the `StableGraph`

is at the maximum number of nodes for
its index type.

source#### pub fn remove_node(&mut self, a: NodeIndex<Ix>) -> Option<N>

#### pub fn remove_node(&mut self, a: NodeIndex<Ix>) -> Option<N>

Remove `a`

from the graph if it exists, and return its weight.
If it doesn’t exist in the graph, return `None`

.

The node index `a`

is invalidated, but none other.
Edge indices are invalidated as they would be following the removal of
each edge with an endpoint in `a`

.

Computes in **O(e’)** time, where **e’** is the number of affected
edges, including *n* calls to `.remove_edge()`

where *n* is the number
of edges with an endpoint in `a`

.

#### pub fn contains_node(&self, a: NodeIndex<Ix>) -> bool

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

#### 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 any of the nodes don’t exist.

**Panics** if the `StableGraph`

is at the maximum number of edges for
its index type.

**Note:** `StableGraph`

allows adding parallel (“duplicate”) edges.

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

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

Add or update an edge from `a`

to `b`

.
If the edge already exists, its weight is updated.

Return the index of the affected edge.

Computes in **O(e’)** time, where **e’** is the number of edges
connected to `a`

(and `b`

, if the graph edges are undirected).

**Panics** if any of the nodes don’t exist.

source#### pub fn remove_edge(&mut self, e: EdgeIndex<Ix>) -> Option<E>

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

Remove an edge and return its edge weight, or `None`

if it didn’t exist.

Invalidates the edge index `e`

but no other.

Computes in **O(e’)** time, where **e’** is the number of edges
connected to the same endpoints as `e`

.

source#### pub fn node_weight(&self, a: NodeIndex<Ix>) -> Option<&N>

#### pub fn node_weight(&self, a: NodeIndex<Ix>) -> Option<&N>

Access the weight for node `a`

.

Also available with indexing syntax: `&graph[a]`

.

source#### pub fn node_weight_mut(&mut self, a: NodeIndex<Ix>) -> Option<&mut N>

#### pub fn node_weight_mut(&mut self, a: NodeIndex<Ix>) -> Option<&mut N>

Access the weight for node `a`

, mutably.

Also available with indexing syntax: `&mut graph[a]`

.

source#### pub fn node_weights(&self) -> impl Iterator<Item = &N>

#### pub fn node_weights(&self) -> impl Iterator<Item = &N>

Return an iterator yielding immutable access to all node weights.

The order in which weights are yielded matches the order of their node indices.

source#### pub fn node_weights_mut(&mut self) -> impl Iterator<Item = &mut N>

#### pub fn node_weights_mut(&mut self) -> impl Iterator<Item = &mut N>

Return an iterator yielding mutable access to all node weights.

The order in which weights are yielded matches the order of their node indices.

source#### pub fn node_indices(&self) -> NodeIndices<'_, N, Ix> ⓘ

#### pub fn node_indices(&self) -> NodeIndices<'_, N, Ix> ⓘ

Return an iterator over the node indices of the graph

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

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

Access the weight for edge `e`

.

Also available with indexing syntax: `&graph[e]`

.

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

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

Access the weight for edge `e`

, mutably

Also available with indexing syntax: `&mut graph[e]`

.

source#### pub fn edge_weights(&self) -> impl Iterator<Item = &E>

#### pub fn edge_weights(&self) -> impl Iterator<Item = &E>

Return an iterator yielding immutable access to all edge weights.

The order in which weights are yielded matches the order of their edge indices.

source#### pub fn edge_weights_mut(&mut self) -> impl Iterator<Item = &mut E>

#### pub fn edge_weights_mut(&mut self) -> impl Iterator<Item = &mut E>

Return an iterator yielding mutable access to all edge weights.

The order in which weights are yielded matches the order of their edge indices.

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

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

Access the source and target nodes for `e`

.

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

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

Return an iterator over the edge indices of the graph

source#### pub fn edges_connecting(
&self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> EdgesConnecting<'_, E, Ty, Ix> ⓘ

#### pub fn edges_connecting( &self, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> EdgesConnecting<'_, E, Ty, Ix> ⓘ

Return an iterator over all the edges connecting `a`

and `b`

.

`Directed`

: Outgoing edges from`a`

.`Undirected`

: All edges connected to`a`

.

Iterator element type is `EdgeReference<E, Ix>`

.

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

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

Lookup if there is an edge from `a`

to `b`

.

Computes in **O(e’)** time, where **e’** is the number of edges
connected to `a`

(and `b`

, if the graph edges are undirected).

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

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

Lookup an edge from `a`

to `b`

.

Computes in **O(e’)** time, where **e’** is the number of edges
connected to `a`

(and `b`

, if the graph edges are undirected).

source#### pub fn find_edge_undirected(
&self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> Option<(EdgeIndex<Ix>, Direction)>

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

Lookup an edge between `a`

and `b`

, in either direction.

If the graph is undirected, then this is equivalent to `.find_edge()`

.

Return the edge index and its directionality, with `Outgoing`

meaning
from `a`

to `b`

and `Incoming`

the reverse,
or `None`

if the edge does not exist.

source#### pub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix> ⓘ

#### pub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix> ⓘ

Return an iterator of all nodes with an edge starting from `a`

.

`Directed`

: Outgoing edges from`a`

.`Undirected`

: All edges connected to`a`

.

Produces an empty iterator if the node doesn’t exist.

Iterator element type is `NodeIndex<Ix>`

.

Use `.neighbors(a).detach()`

to get a neighbor walker that does
not borrow from the graph.

source#### pub fn neighbors_directed(
&self,
a: NodeIndex<Ix>,
dir: Direction
) -> Neighbors<'_, E, Ix> ⓘ

#### pub fn neighbors_directed( &self, a: NodeIndex<Ix>, dir: Direction ) -> Neighbors<'_, E, Ix> ⓘ

Return an iterator of all neighbors that have an edge between them and `a`

,
in the specified direction.
If the graph’s edges are undirected, this is equivalent to *.neighbors(a)*.

`Directed`

,`Outgoing`

: All edges from`a`

.`Directed`

,`Incoming`

: All edges to`a`

.`Undirected`

: All edges connected to`a`

.

Produces an empty iterator if the node doesn’t exist.

Iterator element type is `NodeIndex<Ix>`

.

Use `.neighbors_directed(a, dir).detach()`

to get a neighbor walker that does
not borrow from the graph.

source#### pub fn neighbors_undirected(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix> ⓘ

#### pub fn neighbors_undirected(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix> ⓘ

Return an iterator of all neighbors that have an edge between them and `a`

,
in either direction.
If the graph’s edges are undirected, this is equivalent to *.neighbors(a)*.

`Directed`

and`Undirected`

: All edges connected to`a`

.

Produces an empty iterator if the node doesn’t exist.

Iterator element type is `NodeIndex<Ix>`

.

Use `.neighbors_undirected(a).detach()`

to get a neighbor walker that does
not borrow from the graph.

source#### pub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, E, Ty, Ix> ⓘ

#### pub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, E, Ty, Ix> ⓘ

Return an iterator of all edges of `a`

.

`Directed`

: Outgoing edges from`a`

.`Undirected`

: All edges connected to`a`

.

Produces an empty iterator if the node doesn’t exist.

Iterator element type is `EdgeReference<E, Ix>`

.

source#### pub fn edges_directed(
&self,
a: NodeIndex<Ix>,
dir: Direction
) -> Edges<'_, E, Ty, Ix> ⓘ

#### pub fn edges_directed( &self, a: NodeIndex<Ix>, dir: Direction ) -> Edges<'_, E, Ty, Ix> ⓘ

Return an iterator of all edges of `a`

, in the specified direction.

`Directed`

,`Outgoing`

: All edges from`a`

.`Directed`

,`Incoming`

: All edges to`a`

.`Undirected`

,`Outgoing`

: All edges connected to`a`

, with`a`

being the source of each edge.`Undirected`

,`Incoming`

: All edges connected to`a`

, with`a`

being the target of each edge.

Produces an empty iterator if the node `a`

doesn’t exist.

Iterator element type is `EdgeReference<E, Ix>`

.

source#### pub fn externals(&self, dir: Direction) -> Externals<'_, N, Ty, Ix> ⓘ

#### pub fn externals(&self, dir: Direction) -> Externals<'_, N, Ty, Ix> ⓘ

Return an iterator over either the nodes without edges to them
(`Incoming`

) or from them (`Outgoing`

).

An *internal* node has both incoming and outgoing edges.
The nodes in `.externals(Incoming)`

are the source nodes and
`.externals(Outgoing)`

are the sinks of the graph.

For a graph with undirected edges, both the sinks and the sources are just the nodes without edges.

The whole iteration computes in **O(|V|)** time.

source#### pub fn index_twice_mut<T, U>(
&mut self,
i: T,
j: U
) -> (&mut <StableGraph<N, E, Ty, Ix> as Index<T>>::Output, &mut <StableGraph<N, E, Ty, Ix> as Index<U>>::Output)where
StableGraph<N, E, Ty, Ix>: IndexMut<T> + IndexMut<U>,
T: GraphIndex,
U: GraphIndex,

#### pub fn index_twice_mut<T, U>( &mut self, i: T, j: U ) -> (&mut <StableGraph<N, E, Ty, Ix> as Index<T>>::Output, &mut <StableGraph<N, E, Ty, Ix> as Index<U>>::Output)where StableGraph<N, E, Ty, Ix>: IndexMut<T> + IndexMut<U>, T: GraphIndex, U: GraphIndex,

Index the `StableGraph`

by two indices, any combination of
node or edge indices is fine.

**Panics** if the indices are equal or if they are out of bounds.

source#### pub fn retain_nodes<F>(&mut self, visit: F)where
F: FnMut(Frozen<'_, StableGraph<N, E, Ty, Ix>>, NodeIndex<Ix>) -> bool,

#### pub fn retain_nodes<F>(&mut self, visit: F)where F: FnMut(Frozen<'_, StableGraph<N, E, Ty, Ix>>, NodeIndex<Ix>) -> bool,

Keep all nodes that return `true`

from the `visit`

closure,
remove the others.

`visit`

is provided a proxy reference to the graph, so that
the graph can be walked and associated data modified.

The order nodes are visited is not specified.

The node indices of the removed nodes are invalidated, but none other. Edge indices are invalidated as they would be following the removal of each edge with an endpoint in a removed node.

Computes in **O(n + e’)** time, where **n** is the number of node indices and
**e’** is the number of affected edges, including *n* calls to `.remove_edge()`

where *n* is the number of edges with an endpoint in a removed node.

source#### pub fn retain_edges<F>(&mut self, visit: F)where
F: FnMut(Frozen<'_, StableGraph<N, E, Ty, Ix>>, EdgeIndex<Ix>) -> bool,

#### pub fn retain_edges<F>(&mut self, visit: F)where F: FnMut(Frozen<'_, StableGraph<N, E, Ty, Ix>>, EdgeIndex<Ix>) -> bool,

Keep all edges that return `true`

from the `visit`

closure,
remove the others.

`visit`

is provided a proxy reference to the graph, so that
the graph can be walked and associated data modified.

The order edges are visited is not specified.

The edge indices of the removed edes are invalidated, but none other.

Computes in **O(e’‘)** time, **e’** is the number of affected edges,
including the calls to `.remove_edge()`

for each removed edge.

source#### pub fn from_edges<I>(iterable: I) -> StableGraph<N, E, Ty, Ix>where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,

#### pub fn from_edges<I>(iterable: I) -> StableGraph<N, E, Ty, Ix>where I: IntoIterator, <I as IntoIterator>::Item: IntoWeightedEdge<E>, <<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>, N: Default,

Create a new `StableGraph`

from an iterable of edges.

Node weights `N`

are set to default values.
Edge weights `E`

may either be specified in the list,
or they are filled with default values.

Nodes are inserted automatically to match the edges.

```
use petgraph::stable_graph::StableGraph;
let gr = StableGraph::<(), i32>::from_edges(&[
(0, 1), (0, 2), (0, 3),
(1, 2), (1, 3),
(2, 3),
]);
```

source#### pub fn map<'a, F, G, N2, E2>(
&'a self,
node_map: F,
edge_map: G
) -> StableGraph<N2, E2, Ty, Ix>where
F: FnMut(NodeIndex<Ix>, &'a N) -> N2,
G: FnMut(EdgeIndex<Ix>, &'a E) -> E2,

#### pub fn map<'a, F, G, N2, E2>( &'a self, node_map: F, edge_map: G ) -> StableGraph<N2, E2, Ty, Ix>where F: FnMut(NodeIndex<Ix>, &'a N) -> N2, G: FnMut(EdgeIndex<Ix>, &'a E) -> E2,

Create a new `StableGraph`

by mapping node and
edge weights to new values.

The resulting graph has the same structure and the same
graph indices as `self`

.

source#### pub fn filter_map<'a, F, G, N2, E2>(
&'a self,
node_map: F,
edge_map: G
) -> StableGraph<N2, E2, Ty, Ix>where
F: FnMut(NodeIndex<Ix>, &'a N) -> Option<N2>,
G: FnMut(EdgeIndex<Ix>, &'a E) -> Option<E2>,

#### pub fn filter_map<'a, F, G, N2, E2>( &'a self, node_map: F, edge_map: G ) -> StableGraph<N2, E2, Ty, Ix>where F: FnMut(NodeIndex<Ix>, &'a N) -> Option<N2>, G: FnMut(EdgeIndex<Ix>, &'a E) -> Option<E2>,

Create a new `StableGraph`

by mapping nodes and edges.
A node or edge may be mapped to `None`

to exclude it from
the resulting graph.

Nodes are mapped first with the `node_map`

closure, then
`edge_map`

is called for the edges that have not had any endpoint
removed.

The resulting graph has the structure of a subgraph of the original graph. Nodes and edges that are not removed maintain their old node or edge indices.

source#### pub fn extend_with_edges<I>(&mut self, iterable: I)where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,

#### pub fn extend_with_edges<I>(&mut self, iterable: I)where I: IntoIterator, <I as IntoIterator>::Item: IntoWeightedEdge<E>, <<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>, N: Default,

Extend the graph from an iterable of edges.

Node weights `N`

are set to default values.
Edge weights `E`

may either be specified in the list,
or they are filled with default values.

Nodes are inserted automatically to match the edges.

## Trait Implementations§

source§### impl<N, E, Ty, Ix> Build for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Build for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn add_node( &mut self, weight: <StableGraph<N, E, Ty, Ix> as Data>::NodeWeight ) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId

source§#### fn add_edge(
&mut self,
a: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId,
b: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId,
weight: <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight
) -> Option<<StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId>

#### fn add_edge( &mut self, a: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId, b: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId, weight: <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight ) -> Option<<StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId>

`None`

.source§#### fn update_edge(
&mut self,
a: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId,
b: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId,
weight: <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight
) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId

#### fn update_edge( &mut self, a: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId, b: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId, weight: <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight ) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId

`a`

to `b`

. Return the id of the affected
edge.source§### impl<N, E, Ty, Ix> Clone for StableGraph<N, E, Ty, Ix>where
Ix: IndexType,
N: Clone,
E: Clone,

### impl<N, E, Ty, Ix> Clone for StableGraph<N, E, Ty, Ix>where Ix: IndexType, N: Clone, E: Clone,

The resulting cloned graph has the same graph indices as `self`

.

source§#### fn clone(&self) -> StableGraph<N, E, Ty, Ix>

#### fn clone(&self) -> StableGraph<N, E, Ty, Ix>

source§#### fn clone_from(&mut self, rhs: &StableGraph<N, E, Ty, Ix>)

#### fn clone_from(&mut self, rhs: &StableGraph<N, E, Ty, Ix>)

`source`

. Read moresource§### impl<N, E, Ty, Ix> Create for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Create for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn with_capacity(nodes: usize, edges: usize) -> StableGraph<N, E, Ty, Ix>

source§### impl<N, E, Ty, Ix> Data for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Data for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### type NodeWeight = N

#### type EdgeWeight = E

source§### impl<N, E, Ty, Ix> DataMap for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> DataMap for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn node_weight( &self, id: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId ) -> Option<&<StableGraph<N, E, Ty, Ix> as Data>::NodeWeight>

#### fn edge_weight( &self, id: <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId ) -> Option<&<StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight>

source§### impl<N, E, Ty, Ix> DataMapMut for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> DataMapMut for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn node_weight_mut( &mut self, id: <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId ) -> Option<&mut <StableGraph<N, E, Ty, Ix> as Data>::NodeWeight>

#### fn edge_weight_mut( &mut self, id: <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId ) -> Option<&mut <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight>

source§### impl<N, E, Ty, Ix> Debug for StableGraph<N, E, Ty, Ix>where
N: Debug,
E: Debug,
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Debug for StableGraph<N, E, Ty, Ix>where N: Debug, E: Debug, Ty: EdgeType, Ix: IndexType,

source§### impl<N, E, Ty, Ix> Default for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Default for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Create a new empty `StableGraph`

.

source§#### fn default() -> StableGraph<N, E, Ty, Ix>

#### fn default() -> StableGraph<N, E, Ty, Ix>

source§### impl<N, E, Ty, Ix> EdgeCount for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> EdgeCount for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

source§#### fn edge_count(&self) -> usize

#### fn edge_count(&self) -> usize

source§### impl<N, E, Ty, Ix> EdgeIndexable for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> EdgeIndexable for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

source§#### fn edge_bound(&self) -> usize

#### fn edge_bound(&self) -> usize

source§#### fn from_index(
&self,
ix: usize
) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId

#### fn from_index( &self, ix: usize ) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::EdgeId

`i`

to an edge index. `i`

must be a valid value in the graph.source§### impl<N, E, Ty, Ix> From<Graph<N, E, Ty, Ix>> for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> From<Graph<N, E, Ty, Ix>> for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Convert a `Graph`

into a `StableGraph`

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

The resulting graph has the same node and edge indices as the original graph.

source§#### fn from(g: Graph<N, E, Ty, Ix>) -> StableGraph<N, E, Ty, Ix>

#### fn from(g: Graph<N, E, Ty, Ix>) -> StableGraph<N, E, Ty, Ix>

source§### impl<N, E, Ty, Ix> FromElements for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> FromElements for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn from_elements<I>(iterable: I) -> StableGraph<N, E, Ty, Ix>where StableGraph<N, E, Ty, Ix>: Sized, I: IntoIterator<Item = Element<<StableGraph<N, E, Ty, Ix> as Data>::NodeWeight, <StableGraph<N, E, Ty, Ix> as Data>::EdgeWeight>>,

source§### impl<N, E, Ty, Ix> GetAdjacencyMatrix for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> GetAdjacencyMatrix for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

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

.

§#### type AdjMatrix = FixedBitSet

#### type AdjMatrix = FixedBitSet

source§#### fn adjacency_matrix(&self) -> FixedBitSet

#### fn adjacency_matrix(&self) -> FixedBitSet

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

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

source§### impl<N, E, Ty, Ix> GraphBase for StableGraph<N, E, Ty, Ix>where
Ix: IndexType,

### impl<N, E, Ty, Ix> GraphBase for StableGraph<N, E, Ty, Ix>where Ix: IndexType,

source§### impl<N, E, Ty, Ix> Index<EdgeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Index<EdgeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Index the `StableGraph`

by `EdgeIndex`

to access edge weights.

**Panics** if the edge doesn’t exist.

source§### impl<N, E, Ty, Ix> Index<NodeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> Index<NodeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Index the `StableGraph`

by `NodeIndex`

to access node weights.

**Panics** if the node doesn’t exist.

source§### impl<N, E, Ty, Ix> IndexMut<EdgeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> IndexMut<EdgeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Index the `StableGraph`

by `EdgeIndex`

to access edge weights.

**Panics** if the edge doesn’t exist.

source§### impl<N, E, Ty, Ix> IndexMut<NodeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> IndexMut<NodeIndex<Ix>> for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

Index the `StableGraph`

by `NodeIndex`

to access node weights.

**Panics** if the node doesn’t exist.

source§### impl<N, E, Ty, Ix> NodeCount for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> NodeCount for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

#### fn node_count(&self) -> usize

source§### impl<N, E, Ty, Ix> NodeIndexable for StableGraph<N, E, Ty, Ix>where
Ty: EdgeType,
Ix: IndexType,

### impl<N, E, Ty, Ix> NodeIndexable for StableGraph<N, E, Ty, Ix>where Ty: EdgeType, Ix: IndexType,

source§#### fn node_bound(&self) -> usize

#### fn node_bound(&self) -> usize

Return an upper bound of the node indices in the graph

source§#### fn from_index(
&self,
ix: usize
) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId

#### fn from_index( &self, ix: usize ) -> <StableGraph<N, E, Ty, Ix> as GraphBase>::NodeId

`i`

to a node index. `i`

must be a valid value in the graph.