difftastic/rustdoc/petgraph/graph/struct.Graph.html

545 lines
168 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="`Graph&lt;N, E, Ty, Ix&gt;` is a graph datastructure using an adjacency list representation."><title>Graph in petgraph::graph - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="petgraph" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../petgraph/index.html">petgraph</a><span class="version">0.6.4</span></h2></div><h2 class="location"><a href="#">Graph</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.add_edge">add_edge</a></li><li><a href="#method.add_node">add_node</a></li><li><a href="#method.capacity">capacity</a></li><li><a href="#method.clear">clear</a></li><li><a href="#method.clear_edges">clear_edges</a></li><li><a href="#method.contains_edge">contains_edge</a></li><li><a href="#method.edge_count">edge_count</a></li><li><a href="#method.edge_endpoints">edge_endpoints</a></li><li><a href="#method.edge_indices">edge_indices</a></li><li><a href="#method.edge_references">edge_references</a></li><li><a href="#method.edge_weight">edge_weight</a></li><li><a href="#method.edge_weight_mut">edge_weight_mut</a></li><li><a href="#method.edge_weights">edge_weights</a></li><li><a href="#method.edge_weights_mut">edge_weights_mut</a></li><li><a href="#method.edges">edges</a></li><li><a href="#method.edges_connecting">edges_connecting</a></li><li><a href="#method.edges_directed">edges_directed</a></li><li><a href="#method.extend_with_edges">extend_with_edges</a></li><li><a href="#method.externals">externals</a></li><li><a href="#method.filter_map">filter_map</a></li><li><a href="#method.find_edge">find_edge</a></li><li><a href="#method.find_edge_undirected">find_edge_undirected</a></li><li><a href="#method.first_edge">first_edge</a></li><li><a href="#method.from_edges">from_edges</a></li><li><a href="#method.index_twice_mut">index_twice_mut</a></li><li><a href="#method.into_edge_type">into_edge_type</a></li><li><a href="#method.into_nodes_edges">into_nodes_edges</a></li><li><a href="#method.is_directed">is_directed</a></li><li><a href="#method.map">map</a></li><li><a href="#method.neighbors">neighbors</a></li><li><a href="#method.neighbors_directed">neighbors_directed</a></li><li><a href="#method.neighbors_undirected">neighbors_undirected</a></li><li><a href="#method.new">new</a></li><li><a href="#method.new_undirected">new_undirected</a></li><li><a href="#method.next_edge">next_edge</a></li><li><a href="#method.node_count">node_count</a></li><li><a href="#method.node_indices">node_indices</a></li><li><a href="#method.node_weight">node_weight</a></li><li><a href="#method.node_weight_mut">node_weight_mut</a></li><li><a href="#method.node_weights">node_weights</a></li><li><a href="#method.node_weights_mut">node_weights_mut</a></li><li><a href="#method.raw_edges">raw_edges</a></li><li><a href="#method.raw_nodes">raw_nodes</a></li><li><a href="#method.remove_edge">remove_edge</a></li><li><a href="#method.remove_node">remove_node</a></li><li><a href="#method.reserve_edges">reserve_edges</a></li><li><a href="#method.reserve_exact_edges">reserve_exact_edges</a></li><li><a href="#method.reserve_exact_nodes">reserve_exact_nodes</a></li><li><a href="#method.reserve_nodes">reserve_nodes</a></li><li><a href="#method.retain_edges">retain_edges</a></li><li><a href="#method.retain_nodes">retain_nodes</a></li><li><a href="#method.reverse">reverse</a></li><li><a href="#method.shrink_to_fit">shrink_to_fit</a></li><li><a href="#method.shrink_to_fit_edges">shrink_to_fit_edges</a></li><li><a href="#method.shrink_to_fit_nodes">shrink_to_fit_nodes</a></li><li><a href="#method.update_edge">update_edge</a></li><li><a href="#method.with_capacity">with_capacity</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Build-for-Graph%3CN,+E,+Ty,+Ix%3E">Build</a></li><li><a href="#impl-Clone-for-Graph%3CN,+E,+Ty,+Ix%3E">Clone</a></li><li><a href="#impl-Create-for-Graph%3CN,+E,+Ty,+Ix%3E">Create</a></li><li><a href="#impl-Data-for-Graph%3CN,+E,+Ty,+Ix%3E">Data</a></li><li><a href="#impl-DataMap-for-Graph%3CN,+E,+Ty,+Ix%3E">DataMap</a></li><li><a href="#impl-DataMapMut-for-Graph%3CN,+E,+Ty,+Ix%3E">DataMapMut</a></li><li><a href="#impl-Debug-for-Graph%3CN,+E,+Ty,+Ix%3E">Debug</a></li><li><a href="#impl-Default-for-Graph%3CN,+E,+Ty,+Ix%3E">Default</a></li><li><a href="#impl-EdgeCount-for-Graph%3CN,+E,+Ty,+Ix%3E">EdgeCount</a></li><li><a href="#impl-EdgeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E">EdgeIndexable</a></li><li><a href="#impl-From%3CGraph%3CN,+E,+Ty,+Ix%3E%3E-for-StableGraph%3CN,+E,+Ty,+Ix%3E">From&lt;Graph&lt;N, E, Ty, Ix&gt;&gt;</a></li><li><a href="#impl-From%3CStableGraph%3CN,+E,+Ty,+Ix%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E">From&lt;StableGraph&lt;N, E, Ty, Ix&gt;&gt;</a></li><li><a href="#impl-FromElements-for-Graph%3CN,+E,+Ty,+Ix%3E">FromElements</a></li><li><a href="#impl-GetAdjacencyMatrix-for-Graph%3CN,+E,+Ty,+Ix%3E">GetAdjacencyMatrix</a></li><li><a href="#impl-GraphBase-for-Graph%3CN,+E,+Ty,+Ix%3E">GraphBase</a></li><li><a href="#impl-GraphProp-for-Graph%3CN,+E,+Ty,+Ix%3E">GraphProp</a></li><li><a href="#impl-Index%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E">Index&lt;EdgeIndex&lt;Ix&gt;&gt;</a></li><li><a href="#impl-Index%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E">Index&lt;NodeIndex&lt;Ix&gt;&gt;</a></li><li><a href="#impl-IndexMut%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E">IndexMut&lt;EdgeIndex&lt;Ix&gt;&gt;</a></li><li><a href="#impl-IndexMut%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E">IndexMut&lt;NodeIndex&lt;Ix&gt;&gt;</a></li><li><a href="#impl-IntoEdgeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoEdgeReferences</a></li><li><a href="#impl-IntoEdges-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoEdges</a></li><li><a href="#impl-IntoEdgesDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoEdgesDirected</a></li><li><a href="#impl-IntoNeighbors-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoNeighbors</a></li><li><a href="#impl-IntoNeighborsDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoNeighborsDirected</a></li><li><a href="#impl-IntoNodeIdentifiers-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoNodeIdentifiers</a></li><li><a href="#impl-IntoNodeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E">IntoNodeReferences</a></li><li><a href="#impl-NodeCompactIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E">NodeCompactIndexable</a></li><li><a href="#impl-NodeCount-for-Graph%3CN,+E,+Ty,+Ix%3E">NodeCount</a></li><li><a href="#impl-NodeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E">NodeIndexable</a></li><li><a href="#impl-Visitable-for-Graph%3CN,+E,+Ty,+Ix%3E">Visitable</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Graph%3CN,+E,+Ty,+Ix%3E">Send</a></li><li><a href="#impl-Sync-for-Graph%3CN,+E,+Ty,+Ix%3E">Sync</a></li><li><a href="#impl-Unpin-for-Graph%3CN,+E,+Ty,+Ix%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In petgraph::graph</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../petgraph/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">petgraph</a>::<wbr><a href="index.html">graph</a>::<wbr><a class="struct" href="#">Graph</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/petgraph/graph_impl/mod.rs.html#345-349">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Graph&lt;N, E, Ty = <a class="enum" href="../enum.Directed.html" title="enum petgraph::Directed">Directed</a>, Ix = <a class="type" href="type.DefaultIx.html" title="type petgraph::graph::DefaultIx">DefaultIx</a>&gt; { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>Graph&lt;N, E, Ty, Ix&gt;</code> is a graph datastructure using an adjacency list representation.</p>
<p><code>Graph</code> is parameterized over:</p>
<ul>
<li>Associated data <code>N</code> for nodes and <code>E</code> for edges, called <em>weights</em>.
The associated data can be of arbitrary type.</li>
<li>Edge type <code>Ty</code> that determines whether the graph edges are directed or undirected.</li>
<li>Index type <code>Ix</code>, which determines the maximum size of the graph.</li>
</ul>
<p>The <code>Graph</code> is a regular Rust collection and is <code>Send</code> and <code>Sync</code> (as long
as associated data <code>N</code> and <code>E</code> are).</p>
<p>The graph uses <strong>O(|V| + |E|)</strong> space, and allows fast node and edge insert,
efficient graph search and graph algorithms.
It implements <strong>O(e)</strong> edge lookup and edge and node removals, where <strong>e</strong>
is some local measure of edge count.
Based on the graph datastructure used in rustc.</p>
<p>Heres an example of building a graph with directed edges, and below
an illustration of how it could be rendered with graphviz (see
<a href="../dot/struct.Dot.html"><code>Dot</code></a>):</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>petgraph::Graph;
<span class="kw">let </span><span class="kw-2">mut </span>deps = Graph::&lt;<span class="kw-2">&amp;</span>str, <span class="kw-2">&amp;</span>str&gt;::new();
<span class="kw">let </span>pg = deps.add_node(<span class="string">"petgraph"</span>);
<span class="kw">let </span>fb = deps.add_node(<span class="string">"fixedbitset"</span>);
<span class="kw">let </span>qc = deps.add_node(<span class="string">"quickcheck"</span>);
<span class="kw">let </span>rand = deps.add_node(<span class="string">"rand"</span>);
<span class="kw">let </span>libc = deps.add_node(<span class="string">"libc"</span>);
deps.extend_with_edges(<span class="kw-2">&amp;</span>[
(pg, fb), (pg, qc),
(qc, rand), (rand, libc), (qc, libc),
]);</code></pre></div>
<p><img src="https://bluss.github.io/ndarray/images/graph-example.svg" alt="graph-example" /></p>
<h4 id="graph-indices"><a href="#graph-indices">Graph Indices</a></h4>
<p>The graph maintains indices for nodes and edges, and node and edge
weights may be accessed mutably. Indices range in a compact interval, for
example for <em>n</em> nodes indices are 0 to <em>n</em> - 1 inclusive.</p>
<p><code>NodeIndex</code> and <code>EdgeIndex</code> are types that act as references to nodes and edges,
but these are only stable across certain operations:</p>
<ul>
<li><strong>Removing nodes or edges may shift other indices.</strong> Removing a node will
force the last node to shift its index to take its place. Similarly,
removing an edge shifts the index of the last edge.</li>
<li>Adding nodes or edges keeps indices stable.</li>
</ul>
<p>The <code>Ix</code> parameter is <code>u32</code> by default. The goal is that you can ignore this parameter
completely unless you need a very big graph then you can use <code>usize</code>.</p>
<ul>
<li>
<p>The fact that the node and edge indices in the graph each are numbered in compact
intervals (from 0 to <em>n</em> - 1 for <em>n</em> nodes) simplifies some graph algorithms.</p>
</li>
<li>
<p>You can select graph index integer type after the size of the graph. A smaller
size may have better performance.</p>
</li>
<li>
<p>Using indices allows mutation while traversing the graph, see <code>Dfs</code>,
and <code>.neighbors(a).detach()</code>.</p>
</li>
<li>
<p>You can create several graphs using the equal node indices but with
differing weights or differing edges.</p>
</li>
<li>
<p>Indices dont allow as much compile time checking as references.</p>
</li>
</ul>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Graph%3CN,+E%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#453-465">source</a><a href="#impl-Graph%3CN,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, <a class="enum" href="../enum.Directed.html" title="enum petgraph::Directed">Directed</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#458-464">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> with directed edges.</p>
<p>This is a convenience method. Use <code>Graph::with_capacity</code> or <code>Graph::default</code> for
a constructor that is generic in all the type parameters of <code>Graph</code>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Graph%3CN,+E,+Undirected%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#467-479">source</a><a href="#impl-Graph%3CN,+E,+Undirected%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, <a class="enum" href="../enum.Undirected.html" title="enum petgraph::Undirected">Undirected</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new_undirected" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#472-478">source</a><h4 class="code-header">pub fn <a href="#method.new_undirected" class="fn">new_undirected</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> with undirected edges.</p>
<p>This is a convenience method. Use <code>Graph::with_capacity</code> or <code>Graph::default</code> for
a constructor that is generic in all the type parameters of <code>Graph</code>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#481-1461">source</a><a href="#impl-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_capacity" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#487-493">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fn">with_capacity</a>(nodes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, edges: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> with estimated capacity.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_count" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#498-500">source</a><h4 class="code-header">pub fn <a href="#method.node_count" class="fn">node_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of nodes (vertices) in the graph.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_count" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#505-507">source</a><h4 class="code-header">pub fn <a href="#method.edge_count" class="fn">edge_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of edges in the graph.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_directed" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#511-513">source</a><h4 class="code-header">pub fn <a href="#method.is_directed" class="fn">is_directed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether the graph has directed edges or not.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#523-533">source</a><h4 class="code-header">pub fn <a href="#method.add_node" class="fn">add_node</a>(&amp;mut self, weight: N) -&gt; <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;</h4></section></summary><div class="docblock"><p>Add a node (also called vertex) with associated data <code>weight</code> to the graph.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
<p>Return the index of the new node.</p>
<p><strong>Panics</strong> if the Graph is at the maximum number of nodes for its index
type (N/A if usize).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_weight" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#539-541">source</a><h4 class="code-header">pub fn <a href="#method.node_weight" class="fn">node_weight</a>(&amp;self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;N</a>&gt;</h4></section></summary><div class="docblock"><p>Access the weight for node <code>a</code>.</p>
<p>If node <code>a</code> doesnt exist in the graph, return <code>None</code>.
Also available with indexing syntax: <code>&amp;graph[a]</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_weight_mut" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#547-549">source</a><h4 class="code-header">pub fn <a href="#method.node_weight_mut" class="fn">node_weight_mut</a>(&amp;mut self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut N</a>&gt;</h4></section></summary><div class="docblock"><p>Access the weight for node <code>a</code>, mutably.</p>
<p>If node <code>a</code> doesnt exist in the graph, return <code>None</code>.
Also available with indexing syntax: <code>&amp;mut graph[a]</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#564-588">source</a><h4 class="code-header">pub fn <a href="#method.add_edge" class="fn">add_edge</a>(
&amp;mut self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
weight: E
) -&gt; <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</h4></section></summary><div class="docblock"><p>Add an edge from <code>a</code> to <code>b</code> to the graph, with its associated
data <code>weight</code>.</p>
<p>Return the index of the new edge.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
<p><strong>Panics</strong> if any of the nodes dont exist.<br>
<strong>Panics</strong> if the Graph is at the maximum number of edges for its index
type (N/A if usize).</p>
<p><strong>Note:</strong> <code>Graph</code> allows adding parallel (“duplicate”) edges. If you want
to avoid this, use <a href="#method.update_edge"><code>.update_edge(a, b, weight)</code></a> instead.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.update_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#599-607">source</a><h4 class="code-header">pub fn <a href="#method.update_edge" class="fn">update_edge</a>(
&amp;mut self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
weight: E
) -&gt; <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</h4></section></summary><div class="docblock"><p>Add or update an edge from <code>a</code> to <code>b</code>.
If the edge already exists, its weight is updated.</p>
<p>Return the index of the affected edge.</p>
<p>Computes in <strong>O(e)</strong> time, where <strong>e</strong> is the number of edges
connected to <code>a</code> (and <code>b</code>, if the graph edges are undirected).</p>
<p><strong>Panics</strong> if any of the nodes doesnt exist.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_weight" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#613-615">source</a><h4 class="code-header">pub fn <a href="#method.edge_weight" class="fn">edge_weight</a>(&amp;self, e: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;E</a>&gt;</h4></section></summary><div class="docblock"><p>Access the weight for edge <code>e</code>.</p>
<p>If edge <code>e</code> doesnt exist in the graph, return <code>None</code>.
Also available with indexing syntax: <code>&amp;graph[e]</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_weight_mut" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#621-623">source</a><h4 class="code-header">pub fn <a href="#method.edge_weight_mut" class="fn">edge_weight_mut</a>(&amp;mut self, e: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut E</a>&gt;</h4></section></summary><div class="docblock"><p>Access the weight for edge <code>e</code>, mutably.</p>
<p>If edge <code>e</code> doesnt exist in the graph, return <code>None</code>.
Also available with indexing syntax: <code>&amp;mut graph[e]</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_endpoints" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#628-632">source</a><h4 class="code-header">pub fn <a href="#method.edge_endpoints" class="fn">edge_endpoints</a>(
&amp;self,
e: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;)&gt;</h4></section></summary><div class="docblock"><p>Access the source and target nodes for <code>e</code>.</p>
<p>If edge <code>e</code> doesnt exist in the graph, return <code>None</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_node" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#646-689">source</a><h4 class="code-header">pub fn <a href="#method.remove_node" class="fn">remove_node</a>(&amp;mut self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;N&gt;</h4></section></summary><div class="docblock"><p>Remove <code>a</code> from the graph if it exists, and return its weight.
If it doesnt exist in the graph, return <code>None</code>.</p>
<p>Apart from <code>a</code>, this invalidates the last node index in the graph
(that node will adopt the removed node index). Edge indices are
invalidated as they would be following the removal of each edge
with an endpoint in <code>a</code>.</p>
<p>Computes in <strong>O(e)</strong> time, where <strong>e</strong> is the number of affected
edges, including <em>n</em> calls to <code>.remove_edge()</code> where <em>n</em> is the number
of edges with an endpoint in <code>a</code>, and including the edges with an
endpoint in the displaced node.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#735-747">source</a><h4 class="code-header">pub fn <a href="#method.remove_edge" class="fn">remove_edge</a>(&amp;mut self, e: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;E&gt;</h4></section></summary><div class="docblock"><p>Remove an edge and return its edge weight, or <code>None</code> if it didnt exist.</p>
<p>Apart from <code>e</code>, this invalidates the last edge index in the graph
(that edge will adopt the removed edge index).</p>
<p>Computes in <strong>O(e)</strong> time, where <strong>e</strong> is the size of four particular edge lists, for
the vertices of <code>e</code> and the vertices of another affected edge.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.neighbors" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#779-781">source</a><h4 class="code-header">pub fn <a href="#method.neighbors" class="fn">neighbors</a>(&amp;self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'_, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Neighbors&lt;&#39;_, E, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator of all nodes with an edge starting from <code>a</code>.</p>
<ul>
<li><code>Directed</code>: Outgoing edges from <code>a</code>.</li>
<li><code>Undirected</code>: All edges from or to <code>a</code>.</li>
</ul>
<p>Produces an empty iterator if the node doesnt exist.<br>
Iterator element type is <code>NodeIndex&lt;Ix&gt;</code>.</p>
<p>Use <a href="struct.Neighbors.html#method.detach"><code>.neighbors(a).detach()</code></a> to get a neighbor walker that does
not borrow from the graph.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.neighbors_directed" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#802-810">source</a><h4 class="code-header">pub fn <a href="#method.neighbors_directed" class="fn">neighbors_directed</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>
) -&gt; <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'_, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Neighbors&lt;&#39;_, E, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator of all neighbors that have an edge between them and
<code>a</code>, in the specified direction.
If the graphs edges are undirected, this is equivalent to <em>.neighbors(a)</em>.</p>
<ul>
<li><code>Directed</code>, <code>Outgoing</code>: All edges from <code>a</code>.</li>
<li><code>Directed</code>, <code>Incoming</code>: All edges to <code>a</code>.</li>
<li><code>Undirected</code>: All edges from or to <code>a</code>.</li>
</ul>
<p>Produces an empty iterator if the node doesnt exist.<br>
Iterator element type is <code>NodeIndex&lt;Ix&gt;</code>.</p>
<p>For a <code>Directed</code> graph, neighbors are listed in reverse order of their
addition to the graph, so the most recently added edges neighbor is
listed first. The order in an <code>Undirected</code> graph is arbitrary.</p>
<p>Use <a href="struct.Neighbors.html#method.detach"><code>.neighbors_directed(a, dir).detach()</code></a> to get a neighbor walker that does
not borrow from the graph.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.neighbors_undirected" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#826-835">source</a><h4 class="code-header">pub fn <a href="#method.neighbors_undirected" class="fn">neighbors_undirected</a>(&amp;self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'_, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Neighbors&lt;&#39;_, E, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator of all neighbors that have an edge between them and
<code>a</code>, in either direction.
If the graphs edges are undirected, this is equivalent to <em>.neighbors(a)</em>.</p>
<ul>
<li><code>Directed</code> and <code>Undirected</code>: All edges from or to <code>a</code>.</li>
</ul>
<p>Produces an empty iterator if the node doesnt exist.<br>
Iterator element type is <code>NodeIndex&lt;Ix&gt;</code>.</p>
<p>Use <a href="struct.Neighbors.html#method.detach"><code>.neighbors_undirected(a).detach()</code></a> to get a neighbor walker that does
not borrow from the graph.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#844-846">source</a><h4 class="code-header">pub fn <a href="#method.edges" class="fn">edges</a>(&amp;self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'_, E, Ty, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Edges&lt;&#39;_, E, Ty, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator of all edges of <code>a</code>.</p>
<ul>
<li><code>Directed</code>: Outgoing edges from <code>a</code>.</li>
<li><code>Undirected</code>: All edges connected to <code>a</code>.</li>
</ul>
<p>Produces an empty iterator if the node doesnt exist.<br>
Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edges_directed" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#859-870">source</a><h4 class="code-header">pub fn <a href="#method.edges_directed" class="fn">edges_directed</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>
) -&gt; <a class="struct" href="struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'_, E, Ty, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Edges&lt;&#39;_, E, Ty, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator of all edges of <code>a</code>, in the specified direction.</p>
<ul>
<li><code>Directed</code>, <code>Outgoing</code>: All edges from <code>a</code>.</li>
<li><code>Directed</code>, <code>Incoming</code>: All edges to <code>a</code>.</li>
<li><code>Undirected</code>, <code>Outgoing</code>: All edges connected to <code>a</code>, with <code>a</code> being the source of each
edge.</li>
<li><code>Undirected</code>, <code>Incoming</code>: All edges connected to <code>a</code>, with <code>a</code> being the target of each
edge.</li>
</ul>
<p>Produces an empty iterator if the node <code>a</code> doesnt exist.<br>
Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edges_connecting" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#878-888">source</a><h4 class="code-header">pub fn <a href="#method.edges_connecting" class="fn">edges_connecting</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;
) -&gt; <a class="struct" href="struct.EdgesConnecting.html" title="struct petgraph::graph::EdgesConnecting">EdgesConnecting</a>&lt;'_, E, Ty, Ix&gt; <a href="#" class="tooltip" data-notable-ty="EdgesConnecting&lt;&#39;_, E, Ty, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator over all the edges connecting <code>a</code> and <code>b</code>.</p>
<ul>
<li><code>Directed</code>: Outgoing edges from <code>a</code>.</li>
<li><code>Undirected</code>: All edges connected to <code>a</code>.</li>
</ul>
<p>Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.contains_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#894-896">source</a><h4 class="code-header">pub fn <a href="#method.contains_edge" class="fn">contains_edge</a>(&amp;self, a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Lookup if there is an edge from <code>a</code> to <code>b</code>.</p>
<p>Computes in <strong>O(e)</strong> time, where <strong>e</strong> is the number of edges
connected to <code>a</code> (and <code>b</code>, if the graph edges are undirected).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#902-911">source</a><h4 class="code-header">pub fn <a href="#method.find_edge" class="fn">find_edge</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</h4></section></summary><div class="docblock"><p>Lookup an edge from <code>a</code> to <code>b</code>.</p>
<p>Computes in <strong>O(e)</strong> time, where <strong>e</strong> is the number of edges
connected to <code>a</code> (and <code>b</code>, if the graph edges are undirected).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_edge_undirected" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#935-944">source</a><h4 class="code-header">pub fn <a href="#method.find_edge_undirected" class="fn">find_edge_undirected</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>)&gt;</h4></section></summary><div class="docblock"><p>Lookup an edge between <code>a</code> and <code>b</code>, in either direction.</p>
<p>If the graph is undirected, then this is equivalent to <code>.find_edge()</code>.</p>
<p>Return the edge index and its directionality, with <code>Outgoing</code> meaning
from <code>a</code> to <code>b</code> and <code>Incoming</code> the reverse,
or <code>None</code> if the edge does not exist.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.externals" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#975-981">source</a><h4 class="code-header">pub fn <a href="#method.externals" class="fn">externals</a>(&amp;self, dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>) -&gt; <a class="struct" href="struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a>&lt;'_, N, Ty, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Externals&lt;&#39;_, N, Ty, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator over either the nodes without edges to them
(<code>Incoming</code>) or from them (<code>Outgoing</code>).</p>
<p>An <em>internal</em> node has both incoming and outgoing edges.
The nodes in <code>.externals(Incoming)</code> are the source nodes and
<code>.externals(Outgoing)</code> are the sinks of the graph.</p>
<p>For a graph with undirected edges, both the sinks and the sources are
just the nodes without edges.</p>
<p>The whole iteration computes in <strong>O(|V|)</strong> time.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_indices" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#995-1000">source</a><h4 class="code-header">pub fn <a href="#method.node_indices" class="fn">node_indices</a>(&amp;self) -&gt; <a class="struct" href="struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt; <a href="#" class="tooltip" data-notable-ty="NodeIndices&lt;Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator over the node indices of the graph.</p>
<p>For example, in a rare case where a graph algorithm were not applicable,
the following code will iterate through all nodes to find a
specific index:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>index = g.node_indices().find(|i| g[<span class="kw-2">*</span>i] == <span class="string">"book"</span>).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_weights_mut" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1006-1010">source</a><h4 class="code-header">pub fn <a href="#method.node_weights_mut" class="fn">node_weights_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a>&lt;'_, N, Ix&gt; <a href="#" class="tooltip" data-notable-ty="NodeWeightsMut&lt;&#39;_, N, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator yielding mutable access to all node weights.</p>
<p>The order in which weights are yielded matches the order of their
node indices.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_weights" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1016-1020">source</a><h4 class="code-header">pub fn <a href="#method.node_weights" class="fn">node_weights</a>(&amp;self) -&gt; NodeWeights&lt;'_, N, Ix&gt;</h4></section></summary><div class="docblock"><p>Return an iterator yielding immutable access to all node weights.</p>
<p>The order in which weights are yielded matches the order of their
node indices.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_indices" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1023-1028">source</a><h4 class="code-header">pub fn <a href="#method.edge_indices" class="fn">edge_indices</a>(&amp;self) -&gt; <a class="struct" href="struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a>&lt;Ix&gt; <a href="#" class="tooltip" data-notable-ty="EdgeIndices&lt;Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator over the edge indices of the graph</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_references" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1033-1037">source</a><h4 class="code-header">pub fn <a href="#method.edge_references" class="fn">edge_references</a>(&amp;self) -&gt; <a class="struct" href="struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'_, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="EdgeReferences&lt;&#39;_, E, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Create an iterator over all edges, in indexed order.</p>
<p>Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_weights" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1043-1047">source</a><h4 class="code-header">pub fn <a href="#method.edge_weights" class="fn">edge_weights</a>(&amp;self) -&gt; EdgeWeights&lt;'_, E, Ix&gt;</h4></section></summary><div class="docblock"><p>Return an iterator yielding immutable access to all edge weights.</p>
<p>The order in which weights are yielded matches the order of their
edge indices.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.edge_weights_mut" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1052-1056">source</a><h4 class="code-header">pub fn <a href="#method.edge_weights_mut" class="fn">edge_weights_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a>&lt;'_, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="EdgeWeightsMut&lt;&#39;_, E, Ix&gt;"></a></h4></section></summary><div class="docblock"><p>Return an iterator yielding mutable access to all edge weights.</p>
<p>The order in which weights are yielded matches the order of their
edge indices.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.raw_nodes" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1062-1064">source</a><h4 class="code-header">pub fn <a href="#method.raw_nodes" class="fn">raw_nodes</a>(&amp;self) -&gt; &amp;[<a class="struct" href="struct.Node.html" title="struct petgraph::graph::Node">Node</a>&lt;N, Ix&gt;]</h4></section></summary><div class="docblock"><p>Access the internal node array.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.raw_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1067-1069">source</a><h4 class="code-header">pub fn <a href="#method.raw_edges" class="fn">raw_edges</a>(&amp;self) -&gt; &amp;[<a class="struct" href="struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a>&lt;E, Ix&gt;]</h4></section></summary><div class="docblock"><p>Access the internal edge array.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_nodes_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1073-1075">source</a><h4 class="code-header">pub fn <a href="#method.into_nodes_edges" class="fn">into_nodes_edges</a>(self) -&gt; (<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.Node.html" title="struct petgraph::graph::Node">Node</a>&lt;N, Ix&gt;&gt;, <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a>&lt;E, Ix&gt;&gt;)</h4></section></summary><div class="docblock"><p>Convert the graph into a vector of Nodes and a vector of Edges</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.first_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1078-1090">source</a><h4 class="code-header">pub fn <a href="#method.first_edge" class="fn">first_edge</a>(
&amp;self,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</h4></section></summary><div class="docblock"><p>Accessor for data structure internals: the first edge in the given direction.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_edge" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1093-1105">source</a><h4 class="code-header">pub fn <a href="#method.next_edge" class="fn">next_edge</a>(
&amp;self,
e: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;,
dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</h4></section></summary><div class="docblock"><p>Accessor for data structure internals: the next edge for the given direction.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.index_twice_mut" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1140-1163">source</a><h4 class="code-header">pub fn <a href="#method.index_twice_mut" class="fn">index_twice_mut</a>&lt;T, U&gt;(
&amp;mut self,
i: T,
j: U
) -&gt; (&amp;mut &lt;Self as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a>, &amp;mut &lt;Self as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a>)<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;T&gt; + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;U&gt;,
T: <a class="trait" href="trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>,
U: <a class="trait" href="trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>,</div></h4></section></summary><div class="docblock"><p>Index the <code>Graph</code> by two indices, any combination of
node or edge indices is fine.</p>
<p><strong>Panics</strong> if the indices are equal or if they are out of bounds.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>petgraph::{Graph, Incoming};
<span class="kw">use </span>petgraph::visit::Dfs;
<span class="kw">let </span><span class="kw-2">mut </span>gr = Graph::new();
<span class="kw">let </span>a = gr.add_node(<span class="number">0.</span>);
<span class="kw">let </span>b = gr.add_node(<span class="number">0.</span>);
<span class="kw">let </span>c = gr.add_node(<span class="number">0.</span>);
gr.add_edge(a, b, <span class="number">3.</span>);
gr.add_edge(b, c, <span class="number">2.</span>);
gr.add_edge(c, b, <span class="number">1.</span>);
<span class="comment">// walk the graph and sum incoming edges into the node weight
</span><span class="kw">let </span><span class="kw-2">mut </span>dfs = Dfs::new(<span class="kw-2">&amp;</span>gr, a);
<span class="kw">while let </span><span class="prelude-val">Some</span>(node) = dfs.next(<span class="kw-2">&amp;</span>gr) {
<span class="comment">// use a walker -- a detached neighbors iterator
</span><span class="kw">let </span><span class="kw-2">mut </span>edges = gr.neighbors_directed(node, Incoming).detach();
<span class="kw">while let </span><span class="prelude-val">Some</span>(edge) = edges.next_edge(<span class="kw-2">&amp;</span>gr) {
<span class="kw">let </span>(nw, ew) = gr.index_twice_mut(node, edge);
<span class="kw-2">*</span>nw += <span class="kw-2">*</span>ew;
}
}
<span class="comment">// check the result
</span><span class="macro">assert_eq!</span>(gr[a], <span class="number">0.</span>);
<span class="macro">assert_eq!</span>(gr[b], <span class="number">4.</span>);
<span class="macro">assert_eq!</span>(gr[c], <span class="number">2.</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reverse" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1166-1177">source</a><h4 class="code-header">pub fn <a href="#method.reverse" class="fn">reverse</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Reverse the direction of all edges</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1180-1183">source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Remove all nodes and edges</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1186-1191">source</a><h4 class="code-header">pub fn <a href="#method.clear_edges" class="fn">clear_edges</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Remove all edges</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1194-1196">source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&amp;self) -&gt; (<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Return the current node and edge capacity of the graph.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_nodes" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1202-1204">source</a><h4 class="code-header">pub fn <a href="#method.reserve_nodes" class="fn">reserve_nodes</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more nodes to be inserted in
the graph. Graph may reserve more space to avoid frequent reallocations.</p>
<p><strong>Panics</strong> if the new capacity overflows <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1210-1212">source</a><h4 class="code-header">pub fn <a href="#method.reserve_edges" class="fn">reserve_edges</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more edges to be inserted in
the graph. Graph may reserve more space to avoid frequent reallocations.</p>
<p><strong>Panics</strong> if the new capacity overflows <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_exact_nodes" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1221-1223">source</a><h4 class="code-header">pub fn <a href="#method.reserve_exact_nodes" class="fn">reserve_exact_nodes</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves the minimum capacity for exactly <code>additional</code> more nodes to be
inserted in the graph. Does nothing if the capacity is already
sufficient.</p>
<p>Prefer <code>reserve_nodes</code> if future insertions are expected.</p>
<p><strong>Panics</strong> if the new capacity overflows <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_exact_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1232-1234">source</a><h4 class="code-header">pub fn <a href="#method.reserve_exact_edges" class="fn">reserve_exact_edges</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves the minimum capacity for exactly <code>additional</code> more edges to be
inserted in the graph.
Does nothing if the capacity is already sufficient.</p>
<p>Prefer <code>reserve_edges</code> if future insertions are expected.</p>
<p><strong>Panics</strong> if the new capacity overflows <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit_nodes" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1237-1239">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit_nodes" class="fn">shrink_to_fit_nodes</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the underlying nodes collection as much as possible.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1242-1244">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit_edges" class="fn">shrink_to_fit_edges</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the underlying edges collection as much as possible.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1247-1250">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit" class="fn">shrink_to_fit</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the graph as much as possible.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.retain_nodes" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1259-1270">source</a><h4 class="code-header">pub fn <a href="#method.retain_nodes" class="fn">retain_nodes</a>&lt;F&gt;(&amp;mut self, visit: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.Frozen.html" title="struct petgraph::graph::Frozen">Frozen</a>&lt;'_, Self&gt;, <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Keep all nodes that return <code>true</code> from the <code>visit</code> closure,
remove the others.</p>
<p><code>visit</code> is provided a proxy reference to the graph, so that
the graph can be walked and associated data modified.</p>
<p>The order nodes are visited is not specified.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.retain_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1279-1290">source</a><h4 class="code-header">pub fn <a href="#method.retain_edges" class="fn">retain_edges</a>&lt;F&gt;(&amp;mut self, visit: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.Frozen.html" title="struct petgraph::graph::Frozen">Frozen</a>&lt;'_, Self&gt;, <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Keep all edges that return <code>true</code> from the <code>visit</code> closure,
remove the others.</p>
<p><code>visit</code> is provided a proxy reference to the graph, so that
the graph can be walked and associated data modified.</p>
<p>The order edges are visited is not specified.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1309-1319">source</a><h4 class="code-header">pub fn <a href="#method.from_edges" class="fn">from_edges</a>&lt;I&gt;(iterable: I) -&gt; Self<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
I::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a> as <a class="trait" href="../trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;&gt;::<a class="associatedtype" href="../trait.IntoWeightedEdge.html#associatedtype.NodeId" title="type petgraph::IntoWeightedEdge::NodeId">NodeId</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt;,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> from an iterable of edges.</p>
<p>Node weights <code>N</code> are set to default values.
Edge weights <code>E</code> may either be specified in the list,
or they are filled with default values.</p>
<p>Nodes are inserted automatically to match the edges.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>petgraph::Graph;
<span class="kw">let </span>gr = Graph::&lt;(), i32&gt;::from_edges(<span class="kw-2">&amp;</span>[
(<span class="number">0</span>, <span class="number">1</span>), (<span class="number">0</span>, <span class="number">2</span>), (<span class="number">0</span>, <span class="number">3</span>),
(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>),
(<span class="number">2</span>, <span class="number">3</span>),
]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_with_edges" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1328-1348">source</a><h4 class="code-header">pub fn <a href="#method.extend_with_edges" class="fn">extend_with_edges</a>&lt;I&gt;(&amp;mut self, iterable: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
I::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a> as <a class="trait" href="../trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;&gt;::<a class="associatedtype" href="../trait.IntoWeightedEdge.html#associatedtype.NodeId" title="type petgraph::IntoWeightedEdge::NodeId">NodeId</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt;,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h4></section></summary><div class="docblock"><p>Extend the graph from an iterable of edges.</p>
<p>Node weights <code>N</code> are set to default values.
Edge weights <code>E</code> may either be specified in the list,
or they are filled with default values.</p>
<p>Nodes are inserted automatically to match the edges.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.map" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1355-1375">source</a><h4 class="code-header">pub fn <a href="#method.map" class="fn">map</a>&lt;'a, F, G, N2, E2&gt;(
&amp;'a self,
node_map: F,
edge_map: G
) -&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N2, E2, Ty, Ix&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a N</a>) -&gt; N2,
G: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a E</a>) -&gt; E2,</div></h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> by mapping node and
edge weights to new values.</p>
<p>The resulting graph has the same structure and the same
graph indices as <code>self</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter_map" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1389-1417">source</a><h4 class="code-header">pub fn <a href="#method.filter_map" class="fn">filter_map</a>&lt;'a, F, G, N2, E2&gt;(
&amp;'a self,
node_map: F,
edge_map: G
) -&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N2, E2, Ty, Ix&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a N</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;N2&gt;,
G: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a E</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;E2&gt;,</div></h4></section></summary><div class="docblock"><p>Create a new <code>Graph</code> by mapping nodes and edges.
A node or edge may be mapped to <code>None</code> to exclude it from
the resulting graph.</p>
<p>Nodes are mapped first with the <code>node_map</code> closure, then
<code>edge_map</code> is called for the edges that have not had any endpoint
removed.</p>
<p>The resulting graph has the structure of a subgraph of the original graph.
If no nodes are removed, the resulting graph has compatible node
indices; if neither nodes nor edges are removed, the result has
the same graph indices as <code>self</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_edge_type" class="method"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1423-1432">source</a><h4 class="code-header">pub fn <a href="#method.into_edge_type" class="fn">into_edge_type</a>&lt;NewTy&gt;(self) -&gt; <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, NewTy, Ix&gt;<div class="where">where
NewTy: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,</div></h4></section></summary><div class="docblock"><p>Convert the graph into either undirected or directed. No edge adjustments
are done, so you may want to go over the result to remove or add edges.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Build-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#135-159">source</a><a href="#impl-Build-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../data/trait.Build.html" title="trait petgraph::data::Build">Build</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.add_node-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#140-142">source</a><a href="#method.add_node-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.Build.html#tymethod.add_node" class="fn">add_node</a>(&amp;mut self, weight: Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>) -&gt; Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.add_edge-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#143-150">source</a><a href="#method.add_edge-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.Build.html#method.add_edge" class="fn">add_edge</a>(
&amp;mut self,
a: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>,
b: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>,
weight: Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>&gt;</h4></section></summary><div class='docblock'>Add a new edge. If parallel edges (duplicate) are not allowed and
the edge already exists, return <code>None</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.update_edge-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#151-158">source</a><a href="#method.update_edge-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.Build.html#tymethod.update_edge" class="fn">update_edge</a>(
&amp;mut self,
a: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>,
b: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>,
weight: Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>
) -&gt; Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a></h4></section></summary><div class='docblock'>Add or update the edge from <code>a</code> to <code>b</code>. Return the id of the affected
edge.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#364-382">source</a><a href="#impl-Clone-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="docblock"><p>The resulting cloned graph has the same graph indices as <code>self</code>.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#369-375">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; Self</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#377-381">source</a><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, rhs: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Create-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#222-230">source</a><a href="#impl-Create-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../data/trait.Create.html" title="trait petgraph::data::Create">Create</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.with_capacity-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#227-229">source</a><a href="#method.with_capacity-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.Create.html#tymethod.with_capacity" class="fn">with_capacity</a>(nodes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, edges: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; Self</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Data-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#73-79">source</a><a href="#impl-Data-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.Data.html" title="trait petgraph::visit::Data">Data</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.NodeWeight" class="associatedtype trait-impl"><a href="#associatedtype.NodeWeight" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.Data.html#associatedtype.NodeWeight" class="associatedtype">NodeWeight</a> = N</h4></section><section id="associatedtype.EdgeWeight" class="associatedtype trait-impl"><a href="#associatedtype.EdgeWeight" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.Data.html#associatedtype.EdgeWeight" class="associatedtype">EdgeWeight</a> = E</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DataMap-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#81-92">source</a><a href="#impl-DataMap-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../data/trait.DataMap.html" title="trait petgraph::data::DataMap">DataMap</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.node_weight-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#86-88">source</a><a href="#method.node_weight-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.DataMap.html#tymethod.node_weight" class="fn">node_weight</a>(&amp;self, id: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>&gt;</h4></section><section id="method.edge_weight-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#89-91">source</a><a href="#method.edge_weight-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.DataMap.html#tymethod.edge_weight" class="fn">edge_weight</a>(&amp;self, id: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DataMapMut-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#94-105">source</a><a href="#impl-DataMapMut-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../data/trait.DataMapMut.html" title="trait petgraph::data::DataMapMut">DataMapMut</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.node_weight_mut-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#99-101">source</a><a href="#method.node_weight_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.DataMapMut.html#tymethod.node_weight_mut" class="fn">node_weight_mut</a>(&amp;mut self, id: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>&gt;</h4></section><section id="method.edge_weight_mut-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#102-104">source</a><a href="#method.edge_weight_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.DataMapMut.html#tymethod.edge_weight_mut" class="fn">edge_weight_mut</a>(&amp;mut self, id: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#384-426">source</a><a href="#impl-Debug-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#391-425">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1906-1914">source</a><a href="#impl-Default-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Create a new empty <code>Graph</code>.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1911-1913">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-EdgeCount-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2243-2252">source</a><a href="#impl-EdgeCount-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.EdgeCount.html" title="trait petgraph::visit::EdgeCount">EdgeCount</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.edge_count-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2249-2251">source</a><a href="#method.edge_count-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.EdgeCount.html#tymethod.edge_count" class="fn">edge_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return the number of edges in the graph.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-EdgeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2379-2395">source</a><a href="#impl-EdgeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.EdgeIndexable.html" title="trait petgraph::visit::EdgeIndexable">EdgeIndexable</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.edge_bound" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2384-2386">source</a><a href="#method.edge_bound" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.EdgeIndexable.html#tymethod.edge_bound" class="fn">edge_bound</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return an upper bound of the edge indices in the graph
(suitable for the size of a bitmap).</div></details><details class="toggle method-toggle" open><summary><section id="method.to_index-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2388-2390">source</a><a href="#method.to_index-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.EdgeIndexable.html#tymethod.to_index" class="fn">to_index</a>(&amp;self, ix: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Convert <code>a</code> to an integer index.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_index-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2392-2394">source</a><a href="#method.from_index-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.EdgeIndexable.html#tymethod.from_index" class="fn">from_index</a>(&amp;self, ix: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a></h4></section></summary><div class='docblock'>Convert <code>i</code> to an edge index. <code>i</code> must be a valid value in the graph.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CGraph%3CN,+E,+Ty,+Ix%3E%3E-for-StableGraph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1229-1256">source</a><a href="#impl-From%3CGraph%3CN,+E,+Ty,+Ix%3E%3E-for-StableGraph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;&gt; for <a class="struct" href="../stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Convert a <code>Graph</code> into a <code>StableGraph</code></p>
<p>Computes in <strong>O(|V| + |E|)</strong> time.</p>
<p>The resulting graph has the same node and edge indices as
the original graph.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1234-1255">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(g: <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CStableGraph%3CN,+E,+Ty,+Ix%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1268-1296">source</a><a href="#impl-From%3CStableGraph%3CN,+E,+Ty,+Ix%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a>&lt;N, E, Ty, Ix&gt;&gt; for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Convert a <code>StableGraph</code> into a <code>Graph</code></p>
<p>Computes in <strong>O(|V| + |E|)</strong> time.</p>
<p>This translates the stable graph into a graph with node and edge indices in
a compact interval without holes (like <code>Graph</code>s always are).</p>
<p>Only if the stable graph had no vacancies after deletions (if node bound was
equal to node count, and the same for edges), would the resulting graph have
the same node and edge indices as the input.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1273-1295">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(graph: <a class="struct" href="../stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a>&lt;N, E, Ty, Ix&gt;) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromElements-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#325-337">source</a><a href="#impl-FromElements-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../data/trait.FromElements.html" title="trait petgraph::data::FromElements">FromElements</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.from_elements" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/data.rs.html#330-336">source</a><a href="#method.from_elements" class="anchor">§</a><h4 class="code-header">fn <a href="../data/trait.FromElements.html#method.from_elements" class="fn">from_elements</a>&lt;I&gt;(iterable: I) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
I: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="enum" href="../data/enum.Element.html" title="enum petgraph::data::Element">Element</a>&lt;Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>, Self::<a class="associatedtype" href="../visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;&gt;,</div></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-GetAdjacencyMatrix-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/traits_graph.rs.html#16-42">source</a><a href="#impl-GetAdjacencyMatrix-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.GetAdjacencyMatrix.html" title="trait petgraph::visit::GetAdjacencyMatrix">GetAdjacencyMatrix</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>The adjacency matrix for <strong>Graph</strong> is a bitmap thats computed by
<code>.adjacency_matrix()</code>.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.AdjMatrix" class="associatedtype trait-impl"><a href="#associatedtype.AdjMatrix" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.GetAdjacencyMatrix.html#associatedtype.AdjMatrix" class="associatedtype">AdjMatrix</a> = <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></h4></section></summary><div class='docblock'>The associated adjacency matrix type</div></details><details class="toggle method-toggle" open><summary><section id="method.adjacency_matrix" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/traits_graph.rs.html#23-35">source</a><a href="#method.adjacency_matrix" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.GetAdjacencyMatrix.html#tymethod.adjacency_matrix" class="fn">adjacency_matrix</a>(&amp;self) -&gt; <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></h4></section></summary><div class='docblock'>Create the adjacency matrix</div></details><details class="toggle method-toggle" open><summary><section id="method.is_adjacent" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/traits_graph.rs.html#37-41">source</a><a href="#method.is_adjacent" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.GetAdjacencyMatrix.html#tymethod.is_adjacent" class="fn">is_adjacent</a>(
&amp;self,
matrix: &amp;<a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a>,
a: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
b: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;
) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Return true if there is an edge from <code>a</code> to <code>b</code>, false otherwise. <a href="../visit/trait.GetAdjacencyMatrix.html#tymethod.is_adjacent">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-GraphBase-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2130-2136">source</a><a href="#impl-GraphBase-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.GraphBase.html" title="trait petgraph::visit::GraphBase">GraphBase</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.NodeId" class="associatedtype trait-impl"><a href="#associatedtype.NodeId" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.GraphBase.html#associatedtype.NodeId" class="associatedtype">NodeId</a> = <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;</h4></section></summary><div class='docblock'>node identifier</div></details><details class="toggle" open><summary><section id="associatedtype.EdgeId" class="associatedtype trait-impl"><a href="#associatedtype.EdgeId" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.GraphBase.html#associatedtype.EdgeId" class="associatedtype">EdgeId</a> = <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</h4></section></summary><div class='docblock'>edge identifier</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-GraphProp-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2154-2160">source</a><a href="#impl-GraphProp-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.GraphProp.html" title="trait petgraph::visit::GraphProp">GraphProp</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.EdgeType" class="associatedtype trait-impl"><a href="#associatedtype.EdgeType" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.GraphProp.html#associatedtype.EdgeType" class="associatedtype">EdgeType</a> = Ty</h4></section></summary><div class='docblock'>The kind of edges in the graph.</div></details><section id="method.is_directed-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/visit/mod.rs.html#329-331">source</a><a href="#method.is_directed-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.GraphProp.html#method.is_directed" class="fn">is_directed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1881-1890">source</a><a href="#impl-Index%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Index the <code>Graph</code> by <code>EdgeIndex</code> to access edge weights.</p>
<p><strong>Panics</strong> if the edge doesnt exist.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = E</h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1887-1889">source</a><a href="#method.index-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&amp;self, index: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;E</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1854-1863">source</a><a href="#impl-Index%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Index the <code>Graph</code> by <code>NodeIndex</code> to access node weights.</p>
<p><strong>Panics</strong> if the node doesnt exist.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = N</h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1860-1862">source</a><a href="#method.index" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&amp;self, index: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;N</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1895-1903">source</a><a href="#impl-IndexMut%3CEdgeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;<a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Index the <code>Graph</code> by <code>EdgeIndex</code> to access edge weights.</p>
<p><strong>Panics</strong> if the edge doesnt exist.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1900-1902">source</a><a href="#method.index_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(&amp;mut self, index: <a class="struct" href="struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut E</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1868-1876">source</a><a href="#impl-IndexMut%3CNodeIndex%3CIx%3E%3E-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="docblock"><p>Index the <code>Graph</code> by <code>NodeIndex</code> to access node weights.</p>
<p><strong>Panics</strong> if the node doesnt exist.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1873-1875">source</a><a href="#method.index_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(&amp;mut self, index: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut N</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoEdgeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2231-2241">source</a><a href="#impl-IntoEdgeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N: 'a, E: 'a, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoEdgeReferences.html" title="trait petgraph::visit::IntoEdgeReferences">IntoEdgeReferences</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.EdgeRef" class="associatedtype trait-impl"><a href="#associatedtype.EdgeRef" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoEdgeReferences.html#associatedtype.EdgeRef" class="associatedtype">EdgeRef</a> = <a class="struct" href="struct.EdgeReference.html" title="struct petgraph::graph::EdgeReference">EdgeReference</a>&lt;'a, E, Ix&gt;</h4></section><section id="associatedtype.EdgeReferences" class="associatedtype trait-impl"><a href="#associatedtype.EdgeReferences" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoEdgeReferences.html#associatedtype.EdgeReferences" class="associatedtype">EdgeReferences</a> = <a class="struct" href="struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'a, E, Ix&gt;</h4></section><section id="method.edge_references-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2238-2240">source</a><a href="#method.edge_references-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoEdgeReferences.html#tymethod.edge_references" class="fn">edge_references</a>(self) -&gt; Self::<a class="associatedtype" href="../visit/trait.IntoEdgeReferences.html#associatedtype.EdgeReferences" title="type petgraph::visit::IntoEdgeReferences::EdgeReferences">EdgeReferences</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoEdges-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1609-1618">source</a><a href="#impl-IntoEdges-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoEdges.html" title="trait petgraph::visit::IntoEdges">IntoEdges</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Edges" class="associatedtype trait-impl"><a href="#associatedtype.Edges" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoEdges.html#associatedtype.Edges" class="associatedtype">Edges</a> = <a class="struct" href="struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</h4></section><section id="method.edges-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1615-1617">source</a><a href="#method.edges-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoEdges.html#tymethod.edges" class="fn">edges</a>(self, a: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; Self::<a class="associatedtype" href="../visit/trait.IntoEdges.html#associatedtype.Edges" title="type petgraph::visit::IntoEdges::Edges">Edges</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoEdgesDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1620-1629">source</a><a href="#impl-IntoEdgesDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoEdgesDirected.html" title="trait petgraph::visit::IntoEdgesDirected">IntoEdgesDirected</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.EdgesDirected" class="associatedtype trait-impl"><a href="#associatedtype.EdgesDirected" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoEdgesDirected.html#associatedtype.EdgesDirected" class="associatedtype">EdgesDirected</a> = <a class="struct" href="struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</h4></section><section id="method.edges_directed-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#1626-1628">source</a><a href="#method.edges_directed-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoEdgesDirected.html#tymethod.edges_directed" class="fn">edges_directed</a>(self, a: Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, dir: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>) -&gt; Self::<a class="associatedtype" href="../visit/trait.IntoEdgesDirected.html#associatedtype.EdgesDirected" title="type petgraph::visit::IntoEdgesDirected::EdgesDirected">EdgesDirected</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoNeighbors-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2209-2218">source</a><a href="#impl-IntoNeighbors-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E: 'a, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoNeighbors.html" title="trait petgraph::visit::IntoNeighbors">IntoNeighbors</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Neighbors" class="associatedtype trait-impl"><a href="#associatedtype.Neighbors" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoNeighbors.html#associatedtype.Neighbors" class="associatedtype">Neighbors</a> = <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.neighbors-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2215-2217">source</a><a href="#method.neighbors-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoNeighbors.html#tymethod.neighbors" class="fn">neighbors</a>(self, n: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Neighbors&lt;&#39;a, E, Ix&gt;"></a></h4></section></summary><div class='docblock'>Return an iterator of the neighbors of node <code>a</code>.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoNeighborsDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2220-2229">source</a><a href="#impl-IntoNeighborsDirected-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E: 'a, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoNeighborsDirected.html" title="trait petgraph::visit::IntoNeighborsDirected">IntoNeighborsDirected</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.NeighborsDirected" class="associatedtype trait-impl"><a href="#associatedtype.NeighborsDirected" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoNeighborsDirected.html#associatedtype.NeighborsDirected" class="associatedtype">NeighborsDirected</a> = <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h4></section><section id="method.neighbors_directed-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2226-2228">source</a><a href="#method.neighbors_directed-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoNeighborsDirected.html#tymethod.neighbors_directed" class="fn">neighbors_directed</a>(
self,
n: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;,
d: <a class="enum" href="../enum.Direction.html" title="enum petgraph::Direction">Direction</a>
) -&gt; <a class="struct" href="struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <a href="#" class="tooltip" data-notable-ty="Neighbors&lt;&#39;a, E, Ix&gt;"></a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoNodeIdentifiers-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2162-2171">source</a><a href="#impl-IntoNodeIdentifiers-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E: 'a, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoNodeIdentifiers.html" title="trait petgraph::visit::IntoNodeIdentifiers">IntoNodeIdentifiers</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.NodeIdentifiers" class="associatedtype trait-impl"><a href="#associatedtype.NodeIdentifiers" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoNodeIdentifiers.html#associatedtype.NodeIdentifiers" class="associatedtype">NodeIdentifiers</a> = <a class="struct" href="struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</h4></section><section id="method.node_identifiers" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2168-2170">source</a><a href="#method.node_identifiers" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoNodeIdentifiers.html#tymethod.node_identifiers" class="fn">node_identifiers</a>(self) -&gt; <a class="struct" href="struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt; <a href="#" class="tooltip" data-notable-ty="NodeIndices&lt;Ix&gt;"></a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoNodeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2254-2266">source</a><a href="#impl-IntoNodeReferences-for-%26Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.IntoNodeReferences.html" title="trait petgraph::visit::IntoNodeReferences">IntoNodeReferences</a> for &amp;'a <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.NodeRef" class="associatedtype trait-impl"><a href="#associatedtype.NodeRef" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoNodeReferences.html#associatedtype.NodeRef" class="associatedtype">NodeRef</a> = (<a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a N</a>)</h4></section><section id="associatedtype.NodeReferences" class="associatedtype trait-impl"><a href="#associatedtype.NodeReferences" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.IntoNodeReferences.html#associatedtype.NodeReferences" class="associatedtype">NodeReferences</a> = <a class="struct" href="struct.NodeReferences.html" title="struct petgraph::graph::NodeReferences">NodeReferences</a>&lt;'a, N, Ix&gt;</h4></section><section id="method.node_references" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2261-2265">source</a><a href="#method.node_references" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.IntoNodeReferences.html#tymethod.node_references" class="fn">node_references</a>(self) -&gt; Self::<a class="associatedtype" href="../visit/trait.IntoNodeReferences.html#associatedtype.NodeReferences" title="type petgraph::visit::IntoNodeReferences::NodeReferences">NodeReferences</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-NodeCount-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2173-2181">source</a><a href="#impl-NodeCount-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.NodeCount.html" title="trait petgraph::visit::NodeCount">NodeCount</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><section id="method.node_count-1" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2178-2180">source</a><a href="#method.node_count-1" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.NodeCount.html#tymethod.node_count" class="fn">node_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-NodeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2183-2200">source</a><a href="#impl-NodeIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.NodeIndexable.html" title="trait petgraph::visit::NodeIndexable">NodeIndexable</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.node_bound" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2189-2191">source</a><a href="#method.node_bound" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.NodeIndexable.html#tymethod.node_bound" class="fn">node_bound</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return an upper bound of the node indices in the graph
(suitable for the size of a bitmap).</div></details><details class="toggle method-toggle" open><summary><section id="method.to_index" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2193-2195">source</a><a href="#method.to_index" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.NodeIndexable.html#tymethod.to_index" class="fn">to_index</a>(&amp;self, ix: <a class="struct" href="struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Convert <code>a</code> to an integer index.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_index" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2197-2199">source</a><a href="#method.from_index" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.NodeIndexable.html#tymethod.from_index" class="fn">from_index</a>(&amp;self, ix: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; Self::<a class="associatedtype" href="../visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a></h4></section></summary><div class='docblock'>Convert <code>i</code> to a node index. <code>i</code> must be a valid value in the graph.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Visitable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2138-2152">source</a><a href="#impl-Visitable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.Visitable.html" title="trait petgraph::visit::Visitable">Visitable</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Map" class="associatedtype trait-impl"><a href="#associatedtype.Map" class="anchor">§</a><h4 class="code-header">type <a href="../visit/trait.Visitable.html#associatedtype.Map" class="associatedtype">Map</a> = <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></h4></section></summary><div class='docblock'>The associated map type</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_map" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2144-2146">source</a><a href="#method.visit_map" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.Visitable.html#tymethod.visit_map" class="fn">visit_map</a>(&amp;self) -&gt; <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></h4></section></summary><div class='docblock'>Create a new visitor map</div></details><details class="toggle method-toggle" open><summary><section id="method.reset_map" class="method trait-impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2148-2151">source</a><a href="#method.reset_map" class="anchor">§</a><h4 class="code-header">fn <a href="../visit/trait.Visitable.html#tymethod.reset_map" class="fn">reset_map</a>(&amp;self, map: &amp;mut Self::<a class="associatedtype" href="../visit/trait.Visitable.html#associatedtype.Map" title="type petgraph::visit::Visitable::Map">Map</a>)</h4></section></summary><div class='docblock'>Reset the visitor map (and resize to new size of graph if needed)</div></details></div></details><section id="impl-NodeCompactIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a class="src rightside" href="../../src/petgraph/graph_impl/mod.rs.html#2202-2207">source</a><a href="#impl-NodeCompactIndexable-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../visit/trait.NodeCompactIndexable.html" title="trait petgraph::visit::NodeCompactIndexable">NodeCompactIndexable</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
Ty: <a class="trait" href="../trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,
Ix: <a class="trait" href="trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,</div></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,
Ix: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,
Ty: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a href="#impl-Send-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
Ix: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
Ty: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a href="#impl-Sync-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
Ix: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
Ty: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a href="#impl-Unpin-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
Ix: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
Ty: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E" class="impl"><a href="#impl-UnwindSafe-for-Graph%3CN,+E,+Ty,+Ix%3E" class="anchor">§</a><h3 class="code-header">impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,
Ix: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,
N: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,
Ty: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"EdgeIndices<Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.EdgeIndices.html\" title=\"struct petgraph::graph::EdgeIndices\">EdgeIndices</a>&lt;Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.EdgeIndices.html\" title=\"struct petgraph::graph::EdgeIndices\">EdgeIndices</a>&lt;Ix&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.EdgeIndex.html\" title=\"struct petgraph::graph::EdgeIndex\">EdgeIndex</a>&lt;Ix&gt;;</div>","EdgeReferences<'_, E, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.EdgeReferences.html\" title=\"struct petgraph::graph::EdgeReferences\">EdgeReferences</a>&lt;'a, E, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.EdgeReferences.html\" title=\"struct petgraph::graph::EdgeReferences\">EdgeReferences</a>&lt;'a, E, Ix&gt;<div class=\"where\">where\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.EdgeReference.html\" title=\"struct petgraph::graph::EdgeReference\">EdgeReference</a>&lt;'a, E, Ix&gt;;</div>","EdgeWeightsMut<'_, E, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.EdgeWeightsMut.html\" title=\"struct petgraph::graph::EdgeWeightsMut\">EdgeWeightsMut</a>&lt;'a, E, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.EdgeWeightsMut.html\" title=\"struct petgraph::graph::EdgeWeightsMut\">EdgeWeightsMut</a>&lt;'a, E, Ix&gt;<div class=\"where\">where\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.76.0/std/primitive.reference.html\">&amp;'a mut E</a>;</div>","Edges<'_, E, Ty, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Edges.html\" title=\"struct petgraph::graph::Edges\">Edges</a>&lt;'a, E, Ty, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ty, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Edges.html\" title=\"struct petgraph::graph::Edges\">Edges</a>&lt;'a, E, Ty, Ix&gt;<div class=\"where\">where\n Ty: <a class=\"trait\" href=\"../trait.EdgeType.html\" title=\"trait petgraph::EdgeType\">EdgeType</a>,\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.EdgeReference.html\" title=\"struct petgraph::graph::EdgeReference\">EdgeReference</a>&lt;'a, E, Ix&gt;;</div>","EdgesConnecting<'_, E, Ty, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.EdgesConnecting.html\" title=\"struct petgraph::graph::EdgesConnecting\">EdgesConnecting</a>&lt;'a, E, Ty, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ty, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.EdgesConnecting.html\" title=\"struct petgraph::graph::EdgesConnecting\">EdgesConnecting</a>&lt;'a, E, Ty, Ix&gt;<div class=\"where\">where\n Ty: <a class=\"trait\" href=\"../trait.EdgeType.html\" title=\"trait petgraph::EdgeType\">EdgeType</a>,\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.EdgeReference.html\" title=\"struct petgraph::graph::EdgeReference\">EdgeReference</a>&lt;'a, E, Ix&gt;;</div>","Externals<'_, N, Ty, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Externals.html\" title=\"struct petgraph::graph::Externals\">Externals</a>&lt;'a, N, Ty, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, N: 'a, Ty, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Externals.html\" title=\"struct petgraph::graph::Externals\">Externals</a>&lt;'a, N, Ty, Ix&gt;<div class=\"where\">where\n Ty: <a class=\"trait\" href=\"../trait.EdgeType.html\" title=\"trait petgraph::EdgeType\">EdgeType</a>,\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.NodeIndex.html\" title=\"struct petgraph::graph::NodeIndex\">NodeIndex</a>&lt;Ix&gt;;</div>","Neighbors<'_, E, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Neighbors.html\" title=\"struct petgraph::graph::Neighbors\">Neighbors</a>&lt;'a, E, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Neighbors.html\" title=\"struct petgraph::graph::Neighbors\">Neighbors</a>&lt;'a, E, Ix&gt;<div class=\"where\">where\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.NodeIndex.html\" title=\"struct petgraph::graph::NodeIndex\">NodeIndex</a>&lt;Ix&gt;;</div>","Neighbors<'a, E, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Neighbors.html\" title=\"struct petgraph::graph::Neighbors\">Neighbors</a>&lt;'a, E, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, E, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Neighbors.html\" title=\"struct petgraph::graph::Neighbors\">Neighbors</a>&lt;'a, E, Ix&gt;<div class=\"where\">where\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.NodeIndex.html\" title=\"struct petgraph::graph::NodeIndex\">NodeIndex</a>&lt;Ix&gt;;</div>","NodeIndices<Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.NodeIndices.html\" title=\"struct petgraph::graph::NodeIndices\">NodeIndices</a>&lt;Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.NodeIndices.html\" title=\"struct petgraph::graph::NodeIndices\">NodeIndices</a>&lt;Ix&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.NodeIndex.html\" title=\"struct petgraph::graph::NodeIndex\">NodeIndex</a>&lt;Ix&gt;;</div>","NodeWeightsMut<'_, N, Ix>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.NodeWeightsMut.html\" title=\"struct petgraph::graph::NodeWeightsMut\">NodeWeightsMut</a>&lt;'a, N, Ix&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, N, Ix&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.NodeWeightsMut.html\" title=\"struct petgraph::graph::NodeWeightsMut\">NodeWeightsMut</a>&lt;'a, N, Ix&gt;<div class=\"where\">where\n Ix: <a class=\"trait\" href=\"trait.IndexType.html\" title=\"trait petgraph::graph::IndexType\">IndexType</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.76.0/std/primitive.reference.html\">&amp;'a mut N</a>;</div>"}</script></section></div></main></body></html>