634 lines
158 KiB
HTML
634 lines
158 KiB
HTML
|
<!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">☰</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<Graph<N, E, Ty, Ix>></a><a href="#impl-From%3CStableGraph%3CN%2C%20E%2C%20Ty%2C%20Ix%3E%3E">From<StableGraph<N, E, Ty, Ix>></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<NodeIndex<Ix>></a><a href="#impl-IndexMut%3CNodeIndex%3CIx%3E%3E">IndexMut<NodeIndex<Ix>></a><a href="#imp
|
|||
|
</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'>−</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<N, E, Ty = <a class="enum" href="../../petgraph/enum.Directed.html" title="enum petgraph::Directed">Directed</a>, Ix = <a class="type" href="../../petgraph/graph/type.DefaultIx.html" title="type petgraph::graph::DefaultIx">DefaultIx</a>> { /* fields omitted */ }</pre><div class='docblock'><p><code>Graph<N, E, Ty, Ix></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"><</span><span class="kw-2">&</span><span class="ident">str</span>, <span class="kw-2">&</span><span class="ident">str</span><span class="op">></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">"petgraph"</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">"fixedbitset"</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">"quickcheck"</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">"rand"</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">"libc"</span>);
|
|||
|
<span class="ident">deps</span>.<span class="ident">extend_with_edges</span>(<span class="kw-2">&</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<N, E> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, <a class="enum" href="../../petgraph/enum.Directed.html" title="enum petgraph::Directed">Directed</a>></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>() -> 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<N, E> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, <a class="enum" href="../../petgraph/enum.Undirected.html" title="enum petgraph::Undirected">Undirected</a>></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>() -> 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<N, E, Ty, Ix> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>) -> 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>(&self) -> <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>(&self) -> <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>(&self) -> <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>(&mut self, weight: N) -> <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix></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>(&self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>N></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>&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>(&mut self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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#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>&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> &mut self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> weight: E<br>) -> <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix></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> &mut self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> weight: E<br>) -> <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix></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>(&self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>E></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>&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>(&mut self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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#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>&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> &self, <br> e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</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><Ix>, <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix><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#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>(&mut self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><N></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>(&mut self, e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><E></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</span></code></div></div><span id='neighbors.v' class='invisible'><code>pub fn <a href='#method.neighbors' class='fnname'>neighbors</a>(&self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a><E, Ix></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<Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</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> &self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -> <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a><E, Ix></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<Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</span></code></div></div><span id='neighbors_undirected.v' class='invisible'><code>pub fn <a href='#method.neighbors_undirected' class='fnname'>neighbors_undirected</a>(&self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a><E, Ix></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<Ix></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><'a, E, Ty, Ix></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><'a, E, Ty, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ty, Ix> <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><'a, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix>;</span></code></div></div><span id='edges.v' class='invisible'><code>pub fn <a href='#method.edges' class='fnname'>edges</a>(&self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a><E, Ty, Ix></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<E, Ix></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><'a, E, Ty, Ix></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><'a, E, Ty, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ty, Ix> <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><'a, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix>;</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> &self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -> <a class="struct" href="../../petgraph/graph/struct.Edges.html" title="struct petgraph::graph::Edges">Edges</a><E, Ty, Ix></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<E, Ix></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>(&self, a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <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> &self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>></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> &self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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><Ix>, <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>></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><'a, N, Ty, Ix></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><'a, N, Ty, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, N: 'a, Ty, Ix> <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><'a, N, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</span></code></div></div><span id='externals.v' class='invisible'><code>pub fn <a href='#method.externals' class='fnname'>externals</a>(&self, dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a>) -> <a class="struct" href="../../petgraph/graph/struct.Externals.html" title="struct petgraph::graph::Externals">Externals</a><N, Ty, Ix></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><Ix></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><Ix></h3><code class="content"><span class="where fmt-newline">impl<Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>> <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><Ix></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><Ix>;</span></code></div></div><span id='node_indices.v' class='invisible'><code>pub fn <a href='#method.node_indices' class='fnname'>node_indices</a>(&self) -> <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a><Ix></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><'a, N, Ix></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><'a, N, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, N, Ix> <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><'a, N, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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">&'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>(&mut self) -> <a class="struct" href="../../petgraph/graph/struct.NodeWeightsMut.html" title="struct petgraph::graph::NodeWeightsMut">NodeWeightsMut</a><N, Ix></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><Ix></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><Ix></h3><code class="content"><span class="where fmt-newline">impl<Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>> <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><Ix></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><Ix>;</span></code></div></div><span id='edge_indices.v' class='invisible'><code>pub fn <a href='#method.edge_indices' class='fnname'>edge_indices</a>(&self) -> <a class="struct" href="../../petgraph/graph/struct.EdgeIndices.html" title="struct petgraph::graph::EdgeIndices">EdgeIndices</a><Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix>;</span></code></div></div><span id='edge_references.v' class='invisible'><code>pub fn <a href='#method.edge_references' class='fnname'>edge_references</a>(&self) -> <a class="struct" href="../../petgraph/graph/struct.EdgeReferences.html" title="struct petgraph::graph::EdgeReferences">EdgeReferences</a><E, Ix></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<E, Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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">&'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>(&mut self) -> <a class="struct" href="../../petgraph/graph/struct.EdgeWeightsMut.html" title="struct petgraph::graph::EdgeWeightsMut">EdgeWeightsMut</a><E, Ix></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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../../petgraph/graph/struct.Node.html" title="struct petgraph::graph::Node">Node</a><N, Ix><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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../../petgraph/graph/struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a><E, Ix><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) -> <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><<a class="struct" href="../../petgraph/graph/struct.Node.html" title="struct petgraph::graph::Node">Node</a><N, Ix>>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../petgraph/graph/struct.Edge.html" title="struct petgraph::graph::Edge">Edge</a><E, Ix>><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> &self, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>></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> &self, <br> e: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>, <br> dir: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>></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><T, U>(<br> &mut self, <br> i: T, <br> j: U<br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>&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>, &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> 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><T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><U>,<br> T: <a class="trait" href="../../petgraph/graph/trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>,<br> U: <a class="trait" href="../../petgraph/graph/trait.GraphIndex.html" title="trait petgraph::graph::GraphIndex">GraphIndex</a>, </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">&</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">&</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">&</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>(&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>(&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>(&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>(&self) -> <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>(&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>(&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>(&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>(&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>(&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>(&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>(&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><F>(&mut self, visit: F) <span class="where fmt-newline">where<br> 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><Self>, <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </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><F>(&mut self, visit: F) <span class="where fmt-newline">where<br> 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><Self>, <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </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><I>(iterable: I) -> Self <span class="where fmt-newline">where<br> 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> 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><E>,<br> <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><E>>::<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><<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>>,<br> N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>, </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"><</span>(), <span class="ident">i32</span><span class="op">></span>::<span class="ident">from_edges</span>(<span class="kw-2">&</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><I>(&mut self, iterable: I) <span class="where fmt-newline">where<br> 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> 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><E>,<br> <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><E>>::<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><<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>>,<br> N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>, </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><'a, F, G, N2, E2>(<br> &'a self, <br> node_map: F, <br> edge_map: G<br>) -> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N2, E2, Ty, Ix> <span class="where fmt-newline">where<br> 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><Ix>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>N) -> N2,<br> 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><Ix>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>E) -> E2, </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><'a, F, G, N2, E2>(<br> &'a self, <br> node_map: F, <br> edge_map: G<br>) -> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N2, E2, Ty, Ix> <span class="where fmt-newline">where<br> 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><Ix>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>N) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><N2>,<br> 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><Ix>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>E) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><E2>, </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><NewTy>(self) -> <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, NewTy, Ix> <span class="where fmt-newline">where<br> NewTy: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>, </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<'a, N, E: 'a, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoNeighbors.html" title="trait petgraph::visit::IntoNeighbors">IntoNeighbors</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</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><Ix>) -> <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a><'a, E, Ix></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<'a, N, E: 'a, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoNeighborsDirected.html" title="trait petgraph::visit::IntoNeighborsDirected">IntoNeighborsDirected</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix></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><'a, E, Ix></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><'a, E, Ix></h3><code class="content"><span class="where fmt-newline">impl<'a, E, Ix> <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><'a, E, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>;</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> self, <br> n: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> d: <a class="enum" href="../../petgraph/enum.Direction.html" title="enum petgraph::Direction">Direction</a><br>) -> <a class="struct" href="../../petgraph/graph/struct.Neighbors.html" title="struct petgraph::graph::Neighbors">Neighbors</a><'a, E, Ix></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<'a, N, E: 'a, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoNodeIdentifiers.html" title="trait petgraph::visit::IntoNodeIdentifiers">IntoNodeIdentifiers</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix></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><Ix></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><Ix></h3><code class="content"><span class="where fmt-newline">impl<Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>> <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><Ix></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><Ix>;</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) -> <a class="struct" href="../../petgraph/graph/struct.NodeIndices.html" title="struct petgraph::graph::NodeIndices">NodeIndices</a><Ix></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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self) -> <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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self) -> <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<'a, N: 'a, E: 'a, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoEdgeReferences.html" title="trait petgraph::visit::IntoEdgeReferences">IntoEdgeReferences</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ix></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><'a, E, Ix></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) -> 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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self) -> <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>(&self, ix: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <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>(&self, ix: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> 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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix></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><Ix></code></span></h4>
|
|||
|
<div class='docblock'><p>edge identifier</p>
|
|||
|
</div></div><h3 id='impl-Visitable' class='impl'><span class='in-band'><code>impl<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self) -> <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>(&self, map: &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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>></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>(&self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>></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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&mut self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.NodeWeight" title="type petgraph::visit::Data::NodeWeight">NodeWeight</a>></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>(&mut self, id: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.EdgeId" title="type petgraph::visit::GraphBase::EdgeId">EdgeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a>></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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&mut self, weight: 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.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> &mut self, <br> a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br> b: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br> weight: Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><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#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> &mut self, <br> a: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br> b: Self::<a class="type" href="../../petgraph/visit/trait.GraphBase.html#associatedtype.NodeId" title="type petgraph::visit::GraphBase::NodeId">NodeId</a>, <br> weight: Self::<a class="type" href="../../petgraph/visit/trait.Data.html#associatedtype.EdgeWeight" title="type petgraph::visit::Data::EdgeWeight">EdgeWeight</a><br>) -> 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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>) -> 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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><I>(iterable: I) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br> 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><Item = <a class="enum" href="../../petgraph/data/enum.Element.html" title="enum petgraph::data::Element">Element</a><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>>>, </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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix>> for <a class="struct" href="../../petgraph/stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><N, E, Ty, Ix>) -> 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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../../petgraph/stable_graph/struct.StableGraph.html" title="struct petgraph::stable_graph::StableGraph">StableGraph</a><N, E, Ty, Ix>> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><N, E, Ty, Ix>) -> 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<N, E, Ty, Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,<br> E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </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>(&self) -> 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>(&mut self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> N: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br> E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <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<'a, N, E, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoEdges.html" title="trait petgraph::visit::IntoEdges">IntoEdges</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ty, Ix></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>) -> 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<'a, N, E, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoEdgesDirected.html" title="trait petgraph::visit::IntoEdgesDirected">IntoEdgesDirected</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><'a, E, Ty, Ix></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>) -> 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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self, index: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&mut self, index: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self, index: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</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<N, E, Ty, Ix> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>> for <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&mut self, index: <a class="struct" href="../../petgraph/graph/struct.EdgeIndex.html" title="struct petgraph::graph::EdgeIndex">EdgeIndex</a><Ix>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>() -> 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 "default value" 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<'a, N, E, Ty, Ix> <a class="trait" href="../../petgraph/visit/trait.IntoNodeReferences.html" title="trait petgraph::visit::IntoNodeReferences">IntoNodeReferences</a> for &'a <a class="struct" href="../../petgraph/graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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><Ix>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'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><'a, N, Ix></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) -> 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<N, E, Ty, Ix> <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><N, E, Ty, Ix> <span class="where fmt-newline">where<br> Ty: <a class="trait" href="../../petgraph/trait.EdgeType.html" title="trait petgraph::EdgeType">EdgeType</a>,<br> Ix: <a class="trait" href="../../petgraph/graph/trait.IndexType.html" title="trait petgraph::graph::IndexType">IndexType</a>, </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>(&self) -> <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> &self, <br> matrix: &<a class="struct" href="../../fixedbitset/struct.FixedBitSet.html" title="struct fixedbitset::FixedBitSet">FixedBitSet</a>, <br> a: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix>, <br> b: <a class="struct" href="../../petgraph/graph/struct.NodeIndex.html" title="struct petgraph::graph::NodeIndex">NodeIndex</a><Ix><br>) -> <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>⏎</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>
|