mentat/petgraph/graph/struct.Graph.html
2018-08-22 17:04:13 +00:00

634 lines
No EOL
158 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="API documentation for the Rust `Graph` struct in crate `petgraph`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Graph">
<title>petgraph::graph::Graph - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../../dark.css">
<link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Struct Graph</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.new_undirected">new_undirected</a><a href="#method.with_capacity">with_capacity</a><a href="#method.node_count">node_count</a><a href="#method.edge_count">edge_count</a><a href="#method.is_directed">is_directed</a><a href="#method.add_node">add_node</a><a href="#method.node_weight">node_weight</a><a href="#method.node_weight_mut">node_weight_mut</a><a href="#method.add_edge">add_edge</a><a href="#method.update_edge">update_edge</a><a href="#method.edge_weight">edge_weight</a><a href="#method.edge_weight_mut">edge_weight_mut</a><a href="#method.edge_endpoints">edge_endpoints</a><a href="#method.remove_node">remove_node</a><a href="#method.remove_edge">remove_edge</a><a href="#method.neighbors">neighbors</a><a href="#method.neighbors_directed">neighbors_directed</a><a href="#method.neighbors_undirected">neighbors_undirected</a><a href="#method.edges">edges</a><a href="#method.edges_directed">edges_directed</a><a href="#method.contains_edge">contains_edge</a><a href="#method.find_edge">find_edge</a><a href="#method.find_edge_undirected">find_edge_undirected</a><a href="#method.externals">externals</a><a href="#method.node_indices">node_indices</a><a href="#method.node_weights_mut">node_weights_mut</a><a href="#method.edge_indices">edge_indices</a><a href="#method.edge_references">edge_references</a><a href="#method.edge_weights_mut">edge_weights_mut</a><a href="#method.raw_nodes">raw_nodes</a><a href="#method.raw_edges">raw_edges</a><a href="#method.into_nodes_edges">into_nodes_edges</a><a href="#method.first_edge">first_edge</a><a href="#method.next_edge">next_edge</a><a href="#method.index_twice_mut">index_twice_mut</a><a href="#method.reverse">reverse</a><a href="#method.clear">clear</a><a href="#method.clear_edges">clear_edges</a><a href="#method.capacity">capacity</a><a href="#method.reserve_nodes">reserve_nodes</a><a href="#method.reserve_edges">reserve_edges</a><a href="#method.reserve_exact_nodes">reserve_exact_nodes</a><a href="#method.reserve_exact_edges">reserve_exact_edges</a><a href="#method.shrink_to_fit_nodes">shrink_to_fit_nodes</a><a href="#method.shrink_to_fit_edges">shrink_to_fit_edges</a><a href="#method.shrink_to_fit">shrink_to_fit</a><a href="#method.retain_nodes">retain_nodes</a><a href="#method.retain_edges">retain_edges</a><a href="#method.from_edges">from_edges</a><a href="#method.extend_with_edges">extend_with_edges</a><a href="#method.map">map</a><a href="#method.filter_map">filter_map</a><a href="#method.into_edge_type">into_edge_type</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-IntoNeighbors">IntoNeighbors</a><a href="#impl-IntoNeighborsDirected">IntoNeighborsDirected</a><a href="#impl-IntoNodeIdentifiers">IntoNodeIdentifiers</a><a href="#impl-NodeCount">NodeCount</a><a href="#impl-GraphProp">GraphProp</a><a href="#impl-IntoEdgeReferences">IntoEdgeReferences</a><a href="#impl-NodeIndexable">NodeIndexable</a><a href="#impl-NodeCompactIndexable">NodeCompactIndexable</a><a href="#impl-GraphBase">GraphBase</a><a href="#impl-Visitable">Visitable</a><a href="#impl-Data">Data</a><a href="#impl-DataMap">DataMap</a><a href="#impl-DataMapMut">DataMapMut</a><a href="#impl-Build">Build</a><a href="#impl-Create">Create</a><a href="#impl-FromElements">FromElements</a><a href="#impl-From%3CGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E">From&lt;Graph&lt;N, E, Ty, Ix&gt;&gt;</a><a href="#impl-From%3CStableGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E">From&lt;StableGraph&lt;N, E, Ty, Ix&gt;&gt;</a><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-IntoEdges">IntoEdges</a><a href="#impl-IntoEdgesDirected">IntoEdgesDirected</a><a href="#impl-Index%3CNodeIndex%3CIx%3E%3E">Index&lt;NodeIndex&lt;Ix&gt;&gt;</a><a href="#impl-IndexMut%3CNodeIndex%3CIx%3E%3E">IndexMut&lt;NodeIndex&lt;Ix&gt;&gt;</a><a href="#impl-Index%3CEdgeIndex%3CIx%3E%3E">Index&lt;EdgeIndex&lt;Ix&gt;&gt;</a><a href="#impl-IndexMut%3CEdgeIndex%3CIx%3E%3E">IndexMut&lt;EdgeIndex&lt;Ix&gt;&gt;</a><a href="#impl-Default">Default</a><a href="#impl-IntoNodeReferences">IntoNodeReferences</a><a href="#impl-GetAdjacencyMatrix">GetAdjacencyMatrix</a></div></div><p class='location'><a href='../index.html'>petgraph</a>::<wbr><a href='index.html'>graph</a></p><script>window.sidebarCurrent = {name: 'Graph', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>petgraph</a>::<wbr><a href='index.html'>graph</a>::<wbr><a class="struct" href=''>Graph</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#325-329' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Graph&lt;N, E, Ty&nbsp;=&nbsp;<a class="enum" href="../../petgraph/enum.Directed.html" title="enum petgraph::Directed">Directed</a>, Ix&nbsp;=&nbsp;<a class="type" href="../../petgraph/graph/type.DefaultIx.html" title="type petgraph::graph::DefaultIx">DefaultIx</a>&gt; { /* fields omitted */ }</pre><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 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>Here's 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>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">petgraph</span>::<span class="ident">Graph</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">deps</span> <span class="op">=</span> <span class="ident">Graph</span>::<span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">pg</span> <span class="op">=</span> <span class="ident">deps</span>.<span class="ident">add_node</span>(<span class="string">&quot;petgraph&quot;</span>);
<span class="kw">let</span> <span class="ident">fb</span> <span class="op">=</span> <span class="ident">deps</span>.<span class="ident">add_node</span>(<span class="string">&quot;fixedbitset&quot;</span>);
<span class="kw">let</span> <span class="ident">qc</span> <span class="op">=</span> <span class="ident">deps</span>.<span class="ident">add_node</span>(<span class="string">&quot;quickcheck&quot;</span>);
<span class="kw">let</span> <span class="ident">rand</span> <span class="op">=</span> <span class="ident">deps</span>.<span class="ident">add_node</span>(<span class="string">&quot;rand&quot;</span>);
<span class="kw">let</span> <span class="ident">libc</span> <span class="op">=</span> <span class="ident">deps</span>.<span class="ident">add_node</span>(<span class="string">&quot;libc&quot;</span>);
<span class="ident">deps</span>.<span class="ident">extend_with_edges</span>(<span class="kw-2">&amp;</span>[
(<span class="ident">pg</span>, <span class="ident">fb</span>), (<span class="ident">pg</span>, <span class="ident">qc</span>),
(<span class="ident">qc</span>, <span class="ident">rand</span>), (<span class="ident">rand</span>, <span class="ident">libc</span>), (<span class="ident">qc</span>, <span class="ident">libc</span>),
]);</pre>
<p><img src="https://bluss.github.io/ndarray/images/graph-example.svg" alt="graph-example" /></p>
<h3 id="graph-indices" class="section-header"><a href="#graph-indices">Graph Indices</a></h3>
<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.
<strong>Adding nodes or edges keeps indices stable.
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.</p>
<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>
<h3 id="pros-and-cons-of-indices" class="section-header"><a href="#pros-and-cons-of-indices">Pros and Cons of Indices</a></h3>
<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>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>
</li>
<li>
<p>Some indices shift during node or edge removal, so that is a drawback
of removing elements. Indices don't allow as much compile time checking as
references.</p>
</li>
</ul>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;N, E&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, <a class="enum" href="../../petgraph/enum.Directed.html" title="enum petgraph::Directed">Directed</a>&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#421-432' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#427-431' title='goto source code'>[src]</a></span></h4>
<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></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl&lt;N, E&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, <a class="enum" href="../../petgraph/enum.Undirected.html" title="enum petgraph::Undirected">Undirected</a>&gt;</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#434-445' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new_undirected' class="method"><span id='new_undirected.v' class='invisible'><code>pub fn <a href='#method.new_undirected' class='fnname'>new_undirected</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#440-444' title='goto source code'>[src]</a></span></h4>
<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></div><h3 id='impl-2' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#447-1358' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.with_capacity' class="method"><span id='with_capacity.v' class='invisible'><code>pub fn <a href='#method.with_capacity' class='fnname'>with_capacity</a>(nodes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, edges: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#452-456' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Create a new <code>Graph</code> with estimated capacity.</p>
</div><h4 id='method.node_count' class="method"><span id='node_count.v' class='invisible'><code>pub fn <a href='#method.node_count' class='fnname'>node_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#461-464' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return the number of nodes (vertices) in the graph.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
</div><h4 id='method.edge_count' class="method"><span id='edge_count.v' class='invisible'><code>pub fn <a href='#method.edge_count' class='fnname'>edge_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#469-472' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return the number of edges in the graph.</p>
<p>Computes in <strong>O(1)</strong> time.</p>
</div><h4 id='method.is_directed' class="method"><span id='is_directed.v' class='invisible'><code>pub fn <a href='#method.is_directed' class='fnname'>is_directed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#476-479' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Whether the graph has directed edges or not.</p>
</div><h4 id='method.add_node' class="method"><span id='add_node.v' class='invisible'><code>pub fn <a href='#method.add_node' class='fnname'>add_node</a>(&amp;mut self, weight: N) -&gt; <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#489-497' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.node_weight' class="method"><span id='node_weight.v' class='invisible'><code>pub fn <a href='#method.node_weight' class='fnname'>node_weight</a>(&amp;self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>N&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#502-505' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the weight for node <code>a</code>.</p>
<p>Also available with indexing syntax: <code>&amp;graph[a]</code>.</p>
</div><h4 id='method.node_weight_mut' class="method"><span id='node_weight_mut.v' class='invisible'><code>pub fn <a href='#method.node_weight_mut' class='fnname'>node_weight_mut</a>(&amp;mut self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>N&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#510-513' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the weight for node <code>a</code>, mutably.</p>
<p>Also available with indexing syntax: <code>&amp;mut graph[a]</code>.</p>
</div><h4 id='method.add_edge' class="method"><span id='add_edge.v' class='invisible'><code>pub fn <a href='#method.add_edge' class='fnname'>add_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;weight: E<br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#528-553' title='goto source code'>[src]</a></span></h4>
<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 don't 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><h4 id='method.update_edge' class="method"><span id='update_edge.v' class='invisible'><code>pub fn <a href='#method.update_edge' class='fnname'>update_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;weight: E<br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#564-573' title='goto source code'>[src]</a></span></h4>
<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 don't exist.</p>
</div><h4 id='method.edge_weight' class="method"><span id='edge_weight.v' class='invisible'><code>pub fn <a href='#method.edge_weight' class='fnname'>edge_weight</a>(&amp;self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>E&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#578-581' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the weight for edge <code>e</code>.</p>
<p>Also available with indexing syntax: <code>&amp;graph[e]</code>.</p>
</div><h4 id='method.edge_weight_mut' class="method"><span id='edge_weight_mut.v' class='invisible'><code>pub fn <a href='#method.edge_weight_mut' class='fnname'>edge_weight_mut</a>(&amp;mut self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>E&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#586-589' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the weight for edge <code>e</code>, mutably.</p>
<p>Also available with indexing syntax: <code>&amp;mut graph[e]</code>.</p>
</div><h4 id='method.edge_endpoints' class="method"><span id='edge_endpoints.v' class='invisible'><code>pub fn <a href='#method.edge_endpoints' class='fnname'>edge_endpoints</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#592-596' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the source and target nodes for <code>e</code>.</p>
</div><h4 id='method.remove_node' class="method"><span id='remove_node.v' class='invisible'><code>pub fn <a href='#method.remove_node' class='fnname'>remove_node</a>(&amp;mut self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;N&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#610-656' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Remove <code>a</code> from the graph if it exists, and return its weight.
If it doesn't 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><h4 id='method.remove_edge' class="method"><span id='remove_edge.v' class='invisible'><code>pub fn <a href='#method.remove_edge' class='fnname'>remove_edge</a>(&amp;mut self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;E&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#696-709' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Remove an edge and return its edge weight, or <code>None</code> if it didn't 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><h4 id='method.neighbors' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='neighbors.v' class='invisible'><code>pub fn <a href='#method.neighbors' class='fnname'>neighbors</a>(&amp;self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#742-745' title='goto source code'>[src]</a></span></h4>
<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 doesn't 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><h4 id='method.neighbors_directed' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='neighbors_directed.v' class='invisible'><code>pub fn <a href='#method.neighbors_directed' class='fnname'>neighbors_directed</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#766-775' title='goto source code'>[src]</a></span></h4>
<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 graph's 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 doesn't 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 edge's 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><h4 id='method.neighbors_undirected' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='neighbors_undirected.v' class='invisible'><code>pub fn <a href='#method.neighbors_undirected' class='fnname'>neighbors_undirected</a>(&amp;self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#791-801' title='goto source code'>[src]</a></span></h4>
<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 graph's 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 doesn't 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><h4 id='method.edges' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeReference.html" title="struct petgraph::graph::EdgeReference">EdgeReference</a>&lt;'a, E, Ix&gt;;</span></code></div></div><span id='edges.v' class='invisible'><code>pub fn <a href='#method.edges' class='fnname'>edges</a>(&amp;self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;E, Ty, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#810-812' title='goto source code'>[src]</a></span></h4>
<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 doesn't exist.<br>
Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div><h4 id='method.edges_directed' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeReference.html" title="struct petgraph::graph::EdgeReference">EdgeReference</a>&lt;'a, E, Ix&gt;;</span></code></div></div><span id='edges_directed.v' class='invisible'><code>pub fn <a href='#method.edges_directed' class='fnname'>edges_directed</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;E, Ty, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#822-832' title='goto source code'>[src]</a></span></h4>
<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>: All edges connected to <code>a</code>.</li>
</ul>
<p>Produces an empty iterator if the node <code>a</code> doesn't exist.<br>
Iterator element type is <code>EdgeReference&lt;E, Ix&gt;</code>.</p>
</div><h4 id='method.contains_edge' class="method"><span id='contains_edge.v' class='invisible'><code>pub fn <a href='#method.contains_edge' class='fnname'>contains_edge</a>(&amp;self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#857-859' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.find_edge' class="method"><span id='find_edge.v' class='invisible'><code>pub fn <a href='#method.find_edge' class='fnname'>find_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#865-875' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.find_edge_undirected' class="method"><span id='find_edge_undirected.v' class='invisible'><code>pub fn <a href='#method.find_edge_undirected' class='fnname'>find_edge_undirected</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#897-903' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.externals' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a>&lt;'a, N, Ty, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a>&lt;'a, N, Ty, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, N:&nbsp;'a, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a>&lt;'a, N, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='externals.v' class='invisible'><code>pub fn <a href='#method.externals' class='fnname'>externals</a>(&amp;self, dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a>&lt;N, Ty, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#932-935' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.node_indices' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;Ix:&nbsp;<a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='node_indices.v' class='invisible'><code>pub fn <a href='#method.node_indices' class='fnname'>node_indices</a>(&amp;self) -&gt; <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#938-940' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return an iterator over the node indices of the graph</p>
</div><h4 id='method.node_weights_mut' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a>&lt;'a, N, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a>&lt;'a, N, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, N, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a>&lt;'a, N, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>N;</span></code></div></div><span id='node_weights_mut.v' class='invisible'><code>pub fn <a href='#method.node_weights_mut' class='fnname'>node_weights_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../../petgraph/graph/struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a>&lt;N, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#946-949' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.edge_indices' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a>&lt;Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a>&lt;Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;Ix:&nbsp;<a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a>&lt;Ix&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='edge_indices.v' class='invisible'><code>pub fn <a href='#method.edge_indices' class='fnname'>edge_indices</a>(&amp;self) -&gt; <a class="struct" href="../../petgraph/graph/struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#952-954' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return an iterator over the edge indices of the graph</p>
</div><h4 id='method.edge_references' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeReference.html" title="struct petgraph::graph::EdgeReference">EdgeReference</a>&lt;'a, E, Ix&gt;;</span></code></div></div><span id='edge_references.v' class='invisible'><code>pub fn <a href='#method.edge_references' class='fnname'>edge_references</a>(&amp;self) -&gt; <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#959-963' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.edge_weights_mut' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>E;</span></code></div></div><span id='edge_weights_mut.v' class='invisible'><code>pub fn <a href='#method.edge_weights_mut' class='fnname'>edge_weights_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../../petgraph/graph/struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a>&lt;E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#969-972' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.raw_nodes' class="method"><span id='raw_nodes.v' class='invisible'><code>pub fn <a href='#method.raw_nodes' class='fnname'>raw_nodes</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../../petgraph/graph/struct.Node.html" title="struct petgraph::graph::Node">Node</a>&lt;N, Ix&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#978-981' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the internal node array.</p>
</div><h4 id='method.raw_edges' class="method"><span id='raw_edges.v' class='invisible'><code>pub fn <a href='#method.raw_edges' class='fnname'>raw_edges</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../../petgraph/graph/struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a>&lt;E, Ix&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#984-987' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Access the internal edge array.</p>
</div><h4 id='method.into_nodes_edges' class="method"><span id='into_nodes_edges.v' class='invisible'><code>pub fn <a href='#method.into_nodes_edges' class='fnname'>into_nodes_edges</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../petgraph/graph/struct.Node.html" title="struct petgraph::graph::Node">Node</a>&lt;N, Ix&gt;&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../petgraph/graph/struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a>&lt;E, Ix&gt;&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#990-992' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Convert the graph into a vector of Nodes and a vector of Edges</p>
</div><h4 id='method.first_edge' class="method"><span id='first_edge.v' class='invisible'><code>pub fn <a href='#method.first_edge' class='fnname'>first_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#995-1006' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Accessor for data structure internals: the first edge in the given direction.</p>
</div><h4 id='method.next_edge' class="method"><span id='next_edge.v' class='invisible'><code>pub fn <a href='#method.next_edge' class='fnname'>next_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1009-1020' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Accessor for data structure internals: the next edge for the given direction.</p>
</div><h4 id='method.index_twice_mut' class="method"><span id='index_twice_mut.v' class='invisible'><code>pub fn <a href='#method.index_twice_mut' class='fnname'>index_twice_mut</a>&lt;T, U&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;i: T, <br>&nbsp;&nbsp;&nbsp;&nbsp;j: U<br>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>&amp;mut Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a>, &amp;mut Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/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/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;U&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../petgraph/graph/trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../../petgraph/graph/trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1055-1071' title='goto source code'>[src]</a></span></h4>
<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>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">petgraph</span>::{<span class="ident">Graph</span>, <span class="ident">Incoming</span>};
<span class="kw">use</span> <span class="ident">petgraph</span>::<span class="ident">visit</span>::<span class="ident">Dfs</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">gr</span> <span class="op">=</span> <span class="ident">Graph</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">gr</span>.<span class="ident">add_node</span>(<span class="number">0.</span>);
<span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">gr</span>.<span class="ident">add_node</span>(<span class="number">0.</span>);
<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">gr</span>.<span class="ident">add_node</span>(<span class="number">0.</span>);
<span class="ident">gr</span>.<span class="ident">add_edge</span>(<span class="ident">a</span>, <span class="ident">b</span>, <span class="number">3.</span>);
<span class="ident">gr</span>.<span class="ident">add_edge</span>(<span class="ident">b</span>, <span class="ident">c</span>, <span class="number">2.</span>);
<span class="ident">gr</span>.<span class="ident">add_edge</span>(<span class="ident">c</span>, <span class="ident">b</span>, <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> <span class="ident">dfs</span> <span class="op">=</span> <span class="ident">Dfs</span>::<span class="ident">new</span>(<span class="kw-2">&amp;</span><span class="ident">gr</span>, <span class="ident">a</span>);
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">node</span>) <span class="op">=</span> <span class="ident">dfs</span>.<span class="ident">next</span>(<span class="kw-2">&amp;</span><span class="ident">gr</span>) {
<span class="comment">// use a walker -- a detached neighbors iterator</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">edges</span> <span class="op">=</span> <span class="ident">gr</span>.<span class="ident">neighbors_directed</span>(<span class="ident">node</span>, <span class="ident">Incoming</span>).<span class="ident">detach</span>();
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">edge</span>) <span class="op">=</span> <span class="ident">edges</span>.<span class="ident">next_edge</span>(<span class="kw-2">&amp;</span><span class="ident">gr</span>) {
<span class="kw">let</span> (<span class="ident">nw</span>, <span class="ident">ew</span>) <span class="op">=</span> <span class="ident">gr</span>.<span class="ident">index_twice_mut</span>(<span class="ident">node</span>, <span class="ident">edge</span>);
<span class="kw-2">*</span><span class="ident">nw</span> <span class="op">+=</span> <span class="kw-2">*</span><span class="ident">ew</span>;
}
}
<span class="comment">// check the result</span>
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">gr</span>[<span class="ident">a</span>], <span class="number">0.</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">gr</span>[<span class="ident">b</span>], <span class="number">4.</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">gr</span>[<span class="ident">c</span>], <span class="number">2.</span>);</pre>
</div><h4 id='method.reverse' class="method"><span id='reverse.v' class='invisible'><code>pub fn <a href='#method.reverse' class='fnname'>reverse</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1074-1085' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Reverse the direction of all edges</p>
</div><h4 id='method.clear' class="method"><span id='clear.v' class='invisible'><code>pub fn <a href='#method.clear' class='fnname'>clear</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1088-1091' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Remove all nodes and edges</p>
</div><h4 id='method.clear_edges' class="method"><span id='clear_edges.v' class='invisible'><code>pub fn <a href='#method.clear_edges' class='fnname'>clear_edges</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1094-1099' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Remove all edges</p>
</div><h4 id='method.capacity' class="method"><span id='capacity.v' class='invisible'><code>pub fn <a href='#method.capacity' class='fnname'>capacity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1102-1104' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return the current node and edge capacity of the graph.</p>
</div><h4 id='method.reserve_nodes' class="method"><span id='reserve_nodes.v' class='invisible'><code>pub fn <a href='#method.reserve_nodes' class='fnname'>reserve_nodes</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1110-1112' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.reserve_edges' class="method"><span id='reserve_edges.v' class='invisible'><code>pub fn <a href='#method.reserve_edges' class='fnname'>reserve_edges</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1118-1120' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.reserve_exact_nodes' class="method"><span id='reserve_exact_nodes.v' class='invisible'><code>pub fn <a href='#method.reserve_exact_nodes' class='fnname'>reserve_exact_nodes</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1129-1131' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.reserve_exact_edges' class="method"><span id='reserve_exact_edges.v' class='invisible'><code>pub fn <a href='#method.reserve_exact_edges' class='fnname'>reserve_exact_edges</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1140-1142' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.shrink_to_fit_nodes' class="method"><span id='shrink_to_fit_nodes.v' class='invisible'><code>pub fn <a href='#method.shrink_to_fit_nodes' class='fnname'>shrink_to_fit_nodes</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1145-1147' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Shrinks the capacity of the underlying nodes collection as much as possible.</p>
</div><h4 id='method.shrink_to_fit_edges' class="method"><span id='shrink_to_fit_edges.v' class='invisible'><code>pub fn <a href='#method.shrink_to_fit_edges' class='fnname'>shrink_to_fit_edges</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1150-1152' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Shrinks the capacity of the underlying edges collection as much as possible.</p>
</div><h4 id='method.shrink_to_fit' class="method"><span id='shrink_to_fit.v' class='invisible'><code>pub fn <a href='#method.shrink_to_fit' class='fnname'>shrink_to_fit</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1155-1158' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Shrinks the capacity of the graph as much as possible.</p>
</div><h4 id='method.retain_nodes' class="method"><span id='retain_nodes.v' class='invisible'><code>pub fn <a href='#method.retain_nodes' class='fnname'>retain_nodes</a>&lt;F&gt;(&amp;mut self, visit: F) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.Frozen.html" title="struct petgraph::graph::Frozen">Frozen</a>&lt;Self&gt;, <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1167-1177' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.retain_edges' class="method"><span id='retain_edges.v' class='invisible'><code>pub fn <a href='#method.retain_edges' class='fnname'>retain_edges</a>&lt;F&gt;(&amp;mut self, visit: F) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.Frozen.html" title="struct petgraph::graph::Frozen">Frozen</a>&lt;Self&gt;, <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1186-1196' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.from_edges' class="method"><span id='from_edges.v' class='invisible'><code>pub fn <a href='#method.from_edges' class='fnname'>from_edges</a>&lt;I&gt;(iterable: I) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::IntoIterator::Item">Item</a>: <a class="trait" href="../../petgraph/trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::IntoIterator::Item">Item</a> as <a class="trait" href="../../petgraph/trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;&gt;::<a class="type" href="../../petgraph/trait.IntoWeightedEdge.html#associatedtype.NodeId" title="type petgraph::IntoWeightedEdge::NodeId">NodeId</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1216-1225' title='goto source code'>[src]</a></span></h4>
<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>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">petgraph</span>::<span class="ident">Graph</span>;
<span class="kw">let</span> <span class="ident">gr</span> <span class="op">=</span> <span class="ident">Graph</span>::<span class="op">&lt;</span>(), <span class="ident">i32</span><span class="op">&gt;</span>::<span class="ident">from_edges</span>(<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>),
]);</pre>
</div><h4 id='method.extend_with_edges' class="method"><span id='extend_with_edges.v' class='invisible'><code>pub fn <a href='#method.extend_with_edges' class='fnname'>extend_with_edges</a>&lt;I&gt;(&amp;mut self, iterable: I) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::IntoIterator::Item">Item</a>: <a class="trait" href="../../petgraph/trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::IntoIterator::Item">Item</a> as <a class="trait" href="../../petgraph/trait.IntoWeightedEdge.html" title="trait petgraph::IntoWeightedEdge">IntoWeightedEdge</a>&lt;E&gt;&gt;::<a class="type" href="../../petgraph/trait.IntoWeightedEdge.html#associatedtype.NodeId" title="type petgraph::IntoWeightedEdge::NodeId">NodeId</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1234-1253' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.map' class="method"><span id='map.v' class='invisible'><code>pub fn <a href='#method.map' class='fnname'>map</a>&lt;'a, F, G, N2, E2&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'a self, <br>&nbsp;&nbsp;&nbsp;&nbsp;node_map: F, <br>&nbsp;&nbsp;&nbsp;&nbsp;edge_map: G<br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N2, E2, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>N) -&gt; N2,<br>&nbsp;&nbsp;&nbsp;&nbsp;G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>E) -&gt; E2,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1261-1279' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.filter_map' class="method"><span id='filter_map.v' class='invisible'><code>pub fn <a href='#method.filter_map' class='fnname'>filter_map</a>&lt;'a, F, G, N2, E2&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'a self, <br>&nbsp;&nbsp;&nbsp;&nbsp;node_map: F, <br>&nbsp;&nbsp;&nbsp;&nbsp;edge_map: G<br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N2, E2, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>N) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;N2&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>E) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;E2&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1293-1317' title='goto source code'>[src]</a></span></h4>
<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><h4 id='method.into_edge_type' class="method"><span id='into_edge_type.v' class='invisible'><code>pub fn <a href='#method.into_edge_type' class='fnname'>into_edge_type</a>&lt;NewTy&gt;(self) -&gt; <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, NewTy, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;NewTy: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1323-1328' title='goto source code'>[src]</a></span></h4>
<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></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-IntoNeighbors' class='impl'><span class='in-band'><code>impl&lt;'a, N, E:&nbsp;'a, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoNeighbors.html" title="trait petgraph::visit::IntoNeighbors">IntoNeighbors</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoNeighbors' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#170-180' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Neighbors' class="type"><span id='Neighbors.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoNeighbors.html#associatedtype.Neighbors' class="type">Neighbors</a> = <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</code></span></h4>
<h4 id='method.neighbors-1' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='neighbors.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoNeighbors.html#tymethod.neighbors' class='fnname'>neighbors</a>(self, n: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#175-179' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return an iterator of the neighbors of node <code>a</code>.</p>
</div></div><h3 id='impl-IntoNeighborsDirected' class='impl'><span class='in-band'><code>impl&lt;'a, N, E:&nbsp;'a, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoNeighborsDirected.html" title="trait petgraph::visit::IntoNeighborsDirected">IntoNeighborsDirected</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoNeighborsDirected' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#182-192' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.NeighborsDirected' class="type"><span id='NeighborsDirected.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoNeighborsDirected.html#associatedtype.NeighborsDirected' class="type">NeighborsDirected</a> = <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</code></span></h4>
<h4 id='method.neighbors_directed-1' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, E, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='neighbors_directed.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoNeighborsDirected.html#tymethod.neighbors_directed' class='fnname'>neighbors_directed</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;n: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;d: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -&gt; <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a>&lt;'a, E, Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#187-191' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-IntoNodeIdentifiers' class='impl'><span class='in-band'><code>impl&lt;'a, N, E:&nbsp;'a, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoNodeIdentifiers.html" title="trait petgraph::visit::IntoNodeIdentifiers">IntoNodeIdentifiers</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoNodeIdentifiers' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#280-288' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.NodeIdentifiers' class="type"><span id='NodeIdentifiers.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoNodeIdentifiers.html#associatedtype.NodeIdentifiers' class="type">NodeIdentifiers</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</code></span></h4>
<h4 id='method.node_identifiers' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;Ix:&nbsp;<a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;;</span></code></div></div><span id='node_identifiers.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoNodeIdentifiers.html#tymethod.node_identifiers' class='fnname'>node_identifiers</a>(self) -&gt; <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a>&lt;Ix&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#285-287' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-NodeCount' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.NodeCount.html" title="trait petgraph::visit::NodeCount">NodeCount</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-NodeCount' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#290-297' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.node_count-1' class="method"><span id='node_count.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.NodeCount.html#tymethod.node_count' class='fnname'>node_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#294-296' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-GraphProp' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.GraphProp.html" title="trait petgraph::visit::GraphProp">GraphProp</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-GraphProp' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#446-451' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.EdgeType' class="type"><span id='EdgeType.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.GraphProp.html#associatedtype.EdgeType' class="type">EdgeType</a> = Ty</code></span></h4>
<div class='docblock'><p>The kind edges in the graph.</p>
</div><h4 id='method.is_directed-1' class="method"><span id='is_directed.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.GraphProp.html#method.is_directed' class='fnname'>is_directed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#438-440' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-IntoEdgeReferences' class='impl'><span class='in-band'><code>impl&lt;'a, N:&nbsp;'a, E:&nbsp;'a, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoEdgeReferences.html" title="trait petgraph::visit::IntoEdgeReferences">IntoEdgeReferences</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoEdgeReferences' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#470-479' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.EdgeRef' class="type"><span id='EdgeRef.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoEdgeReferences.html#associatedtype.EdgeRef' class="type">EdgeRef</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeReference.html" title="struct petgraph::graph::EdgeReference">EdgeReference</a>&lt;'a, E, Ix&gt;</code></span></h4>
<h4 id='associatedtype.EdgeReferences' class="type"><span id='EdgeReferences.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoEdgeReferences.html#associatedtype.EdgeReferences' class="type">EdgeReferences</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a>&lt;'a, E, Ix&gt;</code></span></h4>
<h4 id='method.edge_references-1' class="method"><span id='edge_references.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoEdgeReferences.html#tymethod.edge_references' class='fnname'>edge_references</a>(self) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.IntoEdgeReferences.html#associatedtype.EdgeReferences" title="type petgraph::visit::IntoEdgeReferences::EdgeReferences">EdgeReferences</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#476-478' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-NodeIndexable' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.NodeIndexable.html" title="trait petgraph::visit::NodeIndexable">NodeIndexable</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-NodeIndexable' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#518-525' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.node_bound' class="method"><span id='node_bound.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.NodeIndexable.html#tymethod.node_bound' class='fnname'>node_bound</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#522' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return an upper bound of the node indices in the graph (suitable for the size of a bitmap). <a href="../../petgraph/visit/trait.NodeIndexable.html#tymethod.node_bound">Read more</a></p>
</div><h4 id='method.to_index' class="method"><span id='to_index.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.NodeIndexable.html#tymethod.to_index' class='fnname'>to_index</a>(&amp;self, ix: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#523' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Convert <code>a</code> to an integer index.</p>
</div><h4 id='method.from_index' class="method"><span id='from_index.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.NodeIndexable.html#tymethod.from_index' class='fnname'>from_index</a>(&amp;self, ix: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#524' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Convert <code>i</code> to a node index</p>
</div></div><h3 id='impl-NodeCompactIndexable' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.NodeCompactIndexable.html" title="trait petgraph::visit::NodeCompactIndexable">NodeCompactIndexable</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-NodeCompactIndexable' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#527-530' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 id='impl-GraphBase' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.GraphBase.html" title="trait petgraph::visit::GraphBase">GraphBase</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-GraphBase' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#603-608' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.NodeId' class="type"><span id='NodeId.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId' class="type">NodeId</a> = <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;</code></span></h4>
<div class='docblock'><p>node identifier</p>
</div><h4 id='associatedtype.EdgeId' class="type"><span id='EdgeId.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId' class="type">EdgeId</a> = <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;</code></span></h4>
<div class='docblock'><p>edge identifier</p>
</div></div><h3 id='impl-Visitable' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.Visitable.html" title="trait petgraph::visit::Visitable">Visitable</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Visitable' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#610-621' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Map' class="type"><span id='Map.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.Visitable.html#associatedtype.Map' class="type">Map</a> = <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></code></span></h4>
<div class='docblock'><p>The associated map type</p>
</div><h4 id='method.visit_map' class="method"><span id='visit_map.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.Visitable.html#tymethod.visit_map' class='fnname'>visit_map</a>(&amp;self) -&gt; <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#615' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Create a new visitor map</p>
</div><h4 id='method.reset_map' class="method"><span id='reset_map.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.Visitable.html#tymethod.reset_map' class='fnname'>reset_map</a>(&amp;self, map: &amp;mut Self::<a class="type" href="../../petgraph/visit/trait.Visitable.html#associatedtype.Map" title="type petgraph::visit::Visitable::Map">Map</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/visit/mod.rs.html#617-620' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Reset the visitor map (and resize to new size of graph if needed)</p>
</div></div><h3 id='impl-Data' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.Data.html" title="trait petgraph::visit::Data">Data</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Data' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#73-78' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.NodeWeight' class="type"><span id='NodeWeight.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight' class="type">NodeWeight</a> = N</code></span></h4>
<h4 id='associatedtype.EdgeWeight' class="type"><span id='EdgeWeight.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight' class="type">EdgeWeight</a> = E</code></span></h4>
</div><h3 id='impl-DataMap' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/data/trait.DataMap.html" title="trait petgraph::data::DataMap">DataMap</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-DataMap' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#80-90' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.node_weight-1' class="method"><span id='node_weight.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.DataMap.html#tymethod.node_weight' class='fnname'>node_weight</a>(&amp;self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#84-86' title='goto source code'>[src]</a></span></h4>
<h4 id='method.edge_weight-1' class="method"><span id='edge_weight.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.DataMap.html#tymethod.edge_weight' class='fnname'>edge_weight</a>(&amp;self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#87-89' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-DataMapMut' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/data/trait.DataMapMut.html" title="trait petgraph::data::DataMapMut">DataMapMut</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-DataMapMut' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#92-102' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.node_weight_mut-1' class="method"><span id='node_weight_mut.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.DataMapMut.html#tymethod.node_weight_mut' class='fnname'>node_weight_mut</a>(&amp;mut self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#96-98' title='goto source code'>[src]</a></span></h4>
<h4 id='method.edge_weight_mut-1' class="method"><span id='edge_weight_mut.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.DataMapMut.html#tymethod.edge_weight_mut' class='fnname'>edge_weight_mut</a>(&amp;mut self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#99-101' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-Build' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/data/trait.Build.html" title="trait petgraph::data::Build">Build</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Build' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#130-151' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.add_node-1' class="method"><span id='add_node.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.Build.html#tymethod.add_node' class='fnname'>add_node</a>(&amp;mut self, weight: Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#134-136' title='goto source code'>[src]</a></span></h4>
<h4 id='method.add_edge-1' class="method"><span id='add_edge.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.Build.html#method.add_edge' class='fnname'>add_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;weight: Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#137-143' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Add a new edge. If parallel edges (duplicate) are not allowed and the edge already exists, return <code>None</code>. <a href="../../petgraph/data/trait.Build.html#method.add_edge">Read more</a></p>
</div><h4 id='method.update_edge-1' class="method"><span id='update_edge.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.Build.html#tymethod.update_edge' class='fnname'>update_edge</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;weight: Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a><br>) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#144-150' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Add or update the edge from <code>a</code> to <code>b</code>. Return the id of the affected edge. <a href="../../petgraph/data/trait.Build.html#tymethod.update_edge">Read more</a></p>
</div></div><h3 id='impl-Create' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/data/trait.Create.html" title="trait petgraph::data::Create">Create</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Create' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#209-216' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.with_capacity-1' class="method"><span id='with_capacity.v-1' class='invisible'><code>fn <a href='../../petgraph/data/trait.Create.html#tymethod.with_capacity' class='fnname'>with_capacity</a>(nodes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, edges: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#213-215' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-FromElements' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/data/trait.FromElements.html" title="trait petgraph::data::FromElements">FromElements</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-FromElements' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#302-312' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_elements' class="method"><span id='from_elements.v' class='invisible'><code>fn <a href='../../petgraph/data/trait.FromElements.html#method.from_elements' class='fnname'>from_elements</a>&lt;I&gt;(iterable: I) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&lt;Item = <a class="enum" href="../../petgraph/data/enum.Element.html" title="enum petgraph::data::Element">Element</a>&lt;Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>, Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>&gt;&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/data.rs.html#306-311' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-From%3CGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;&gt; for <a class="struct" href="../../petgraph/stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-From%3CGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1084-1106' title='goto source code'>[src]</a></span></h3>
<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'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(g: <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt;) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1088-1105' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 id='impl-From%3CStableGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../../petgraph/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="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-From%3CStableGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1118-1145' title='goto source code'>[src]</a></span></h3>
<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'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(graph: <a class="struct" href="../../petgraph/stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a>&lt;N, E, Ty, Ix&gt;) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/stable_graph/mod.rs.html#1122-1144' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix:&nbsp;<a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#345-361' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>The resulting cloned graph has the same graph indices as <code>self</code>.</p>
</div><div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#348-354' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#356-360' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#363-395' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#369-394' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-IntoEdges' class='impl'><span class='in-band'><code>impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoEdges.html" title="trait petgraph::visit::IntoEdges">IntoEdges</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoEdges' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1503-1511' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Edges' class="type"><span id='Edges.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoEdges.html#associatedtype.Edges' class="type">Edges</a> = <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</code></span></h4>
<h4 id='method.edges-1' class="method"><span id='edges.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoEdges.html#tymethod.edges' class='fnname'>edges</a>(self, a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.IntoEdges.html#associatedtype.Edges" title="type petgraph::visit::IntoEdges::Edges">Edges</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1508-1510' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-IntoEdgesDirected' class='impl'><span class='in-band'><code>impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoEdgesDirected.html" title="trait petgraph::visit::IntoEdgesDirected">IntoEdgesDirected</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoEdgesDirected' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1513-1521' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.EdgesDirected' class="type"><span id='EdgesDirected.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoEdgesDirected.html#associatedtype.EdgesDirected' class="type">EdgesDirected</a> = <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a>&lt;'a, E, Ty, Ix&gt;</code></span></h4>
<h4 id='method.edges_directed-1' class="method"><span id='edges_directed.v-1' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoEdgesDirected.html#tymethod.edges_directed' class='fnname'>edges_directed</a>(self, a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a>) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.IntoEdgesDirected.html#associatedtype.EdgesDirected" title="type petgraph::visit::IntoEdgesDirected::EdgesDirected">EdgesDirected</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1518-1520' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-Index%3CNodeIndex%3CIx%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Index%3CNodeIndex%3CIx%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1652-1660' title='goto source code'>[src]</a></span></h3>
<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 doesn't exist.</p>
</div><div class='impl-items'><h4 id='associatedtype.Output' class="type"><span id='Output.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output' class="type">Output</a> = N</code></span></h4>
<div class='docblock'><p>The returned type after indexing.</p>
</div><h4 id='method.index' class="method"><span id='index.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>N</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1657-1659' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the indexing (<code>container[index]</code>) operation.</p>
</div></div><h3 id='impl-IndexMut%3CNodeIndex%3CIx%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IndexMut%3CNodeIndex%3CIx%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1665-1673' title='goto source code'>[src]</a></span></h3>
<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 doesn't exist.</p>
</div><div class='impl-items'><h4 id='method.index_mut' class="method"><span id='index_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut' class='fnname'>index_mut</a>(&amp;mut self, index: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>N</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1669-1671' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the mutable indexing (<code>container[index]</code>) operation.</p>
</div></div><h3 id='impl-Index%3CEdgeIndex%3CIx%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Index%3CEdgeIndex%3CIx%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1678-1686' title='goto source code'>[src]</a></span></h3>
<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 doesn't exist.</p>
</div><div class='impl-items'><h4 id='associatedtype.Output-1' class="type"><span id='Output.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output' class="type">Output</a> = E</code></span></h4>
<div class='docblock'><p>The returned type after indexing.</p>
</div><h4 id='method.index-1' class="method"><span id='index.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>E</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1683-1685' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the indexing (<code>container[index]</code>) operation.</p>
</div></div><h3 id='impl-IndexMut%3CEdgeIndex%3CIx%3E%3E' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a>&lt;<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;&gt; for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IndexMut%3CEdgeIndex%3CIx%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1691-1698' title='goto source code'>[src]</a></span></h3>
<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 doesn't exist.</p>
</div><div class='impl-items'><h4 id='method.index_mut-1' class="method"><span id='index_mut.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut' class='fnname'>index_mut</a>(&amp;mut self, index: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a>&lt;Ix&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>E</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1695-1697' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the mutable indexing (<code>container[index]</code>) operation.</p>
</div></div><h3 id='impl-Default' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-Default' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1701-1706' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Create a new empty <code>Graph</code>.</p>
</div><div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1705' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the &quot;default value&quot; for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
</div></div><h3 id='impl-IntoNodeReferences' class='impl'><span class='in-band'><code>impl&lt;'a, N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.IntoNodeReferences.html" title="trait petgraph::visit::IntoNodeReferences">IntoNodeReferences</a> for &amp;'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-IntoNodeReferences' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1904-1915' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.NodeRef' class="type"><span id='NodeRef.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoNodeReferences.html#associatedtype.NodeRef' class="type">NodeRef</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>N<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
<h4 id='associatedtype.NodeReferences' class="type"><span id='NodeReferences.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.IntoNodeReferences.html#associatedtype.NodeReferences' class="type">NodeReferences</a> = <a class="struct" href="../../petgraph/graph/struct.NodeReferences.html" title="struct petgraph::graph::NodeReferences">NodeReferences</a>&lt;'a, N, Ix&gt;</code></span></h4>
<h4 id='method.node_references' class="method"><span id='node_references.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.IntoNodeReferences.html#tymethod.node_references' class='fnname'>node_references</a>(self) -&gt; Self::<a class="type" href="../../petgraph/visit/trait.IntoNodeReferences.html#associatedtype.NodeReferences" title="type petgraph::visit::IntoNodeReferences::NodeReferences">NodeReferences</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/graph_impl/mod.rs.html#1910-1914' title='goto source code'>[src]</a></span></h4>
</div><h3 id='impl-GetAdjacencyMatrix' class='impl'><span class='in-band'><code>impl&lt;N, E, Ty, Ix&gt; <a class="trait" href="../../petgraph/visit/trait.GetAdjacencyMatrix.html" title="trait petgraph::visit::GetAdjacencyMatrix">GetAdjacencyMatrix</a> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a>&lt;N, E, Ty, Ix&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>,&nbsp;</span></code><a href='#impl-GetAdjacencyMatrix' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/traits_graph.rs.html#23-50' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>The adjacency matrix for <strong>Graph</strong> is a bitmap that's computed by
<code>.adjacency_matrix()</code>.</p>
</div><div class='impl-items'><h4 id='associatedtype.AdjMatrix' class="type"><span id='AdjMatrix.t' class='invisible'><code>type <a href='../../petgraph/visit/trait.GetAdjacencyMatrix.html#associatedtype.AdjMatrix' class="type">AdjMatrix</a> = <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></code></span></h4>
<div class='docblock'><p>The associated adjacency matrix type</p>
</div><h4 id='method.adjacency_matrix' class="method"><span id='adjacency_matrix.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.GetAdjacencyMatrix.html#tymethod.adjacency_matrix' class='fnname'>adjacency_matrix</a>(&amp;self) -&gt; <a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/traits_graph.rs.html#29-42' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Create the adjacency matrix</p>
</div><h4 id='method.is_adjacent' class="method"><span id='is_adjacent.v' class='invisible'><code>fn <a href='../../petgraph/visit/trait.GetAdjacencyMatrix.html#tymethod.is_adjacent' class='fnname'>is_adjacent</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;matrix: &amp;<a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a>&lt;Ix&gt;<br>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/petgraph/traits_graph.rs.html#44-49' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Return true if there is an edge from <code>a</code> to <code>b</code>, false otherwise. <a href="../../petgraph/visit/trait.GetAdjacencyMatrix.html#tymethod.is_adjacent">Read more</a></p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "petgraph";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>