|
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Graph algorithms."><title>petgraph::algo - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="petgraph" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../petgraph/index.html">petgraph</a><span class="version">0.6.4</span></h2></div><h2 class="location"><a href="#">Module algo</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate petgraph</a></h2></div></nav><div class="sidebar-resizer"></div>
|
|
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../petgraph/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">petgraph</a>::<wbr><a class="mod" href="#">algo</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/petgraph/algo/mod.rs.html#1-903">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Graph algorithms.</p>
|
|
|
<p>It is a goal to gradually migrate the algorithms to be based on graph traits
|
|
|
so that they are generally applicable. For now, some of these still require
|
|
|
the <code>Graph</code> type.</p>
|
|
|
</div></details><h2 id="reexports" class="section-header"><a href="#reexports">Re-exports</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.astar"><code>pub use astar::<a class="fn" href="astar/fn.astar.html" title="fn petgraph::algo::astar::astar">astar</a>;</code></div></li><li><div class="item-name" id="reexport.bellman_ford"><code>pub use bellman_ford::<a class="fn" href="bellman_ford/fn.bellman_ford.html" title="fn petgraph::algo::bellman_ford::bellman_ford">bellman_ford</a>;</code></div></li><li><div class="item-name" id="reexport.find_negative_cycle"><code>pub use bellman_ford::<a class="fn" href="bellman_ford/fn.find_negative_cycle.html" title="fn petgraph::algo::bellman_ford::find_negative_cycle">find_negative_cycle</a>;</code></div></li><li><div class="item-name" id="reexport.dijkstra"><code>pub use dijkstra::<a class="fn" href="dijkstra/fn.dijkstra.html" title="fn petgraph::algo::dijkstra::dijkstra">dijkstra</a>;</code></div></li><li><div class="item-name" id="reexport.greedy_feedback_arc_set"><code>pub use feedback_arc_set::<a class="fn" href="feedback_arc_set/fn.greedy_feedback_arc_set.html" title="fn petgraph::algo::feedback_arc_set::greedy_feedback_arc_set">greedy_feedback_arc_set</a>;</code></div></li><li><div class="item-name" id="reexport.floyd_warshall"><code>pub use floyd_warshall::<a class="fn" href="floyd_warshall/fn.floyd_warshall.html" title="fn petgraph::algo::floyd_warshall::floyd_warshall">floyd_warshall</a>;</code></div></li><li><div class="item-name" id="reexport.is_isomorphic"><code>pub use isomorphism::<a class="fn" href="isomorphism/fn.is_isomorphic.html" title="fn petgraph::algo::isomorphism::is_isomorphic">is_isomorphic</a>;</code></div></li><li><div class="item-name" id="reexport.is_isomorphic_matching"><code>pub use isomorphism::<a class="fn" href="isomorphism/fn.is_isomorphic_matching.html" title="fn petgraph::algo::isomorphism::is_isomorphic_matching">is_isomorphic_matching</a>;</code></div></li><li><div class="item-name" id="reexport.is_isomorphic_subgraph"><code>pub use isomorphism::<a class="fn" href="isomorphism/fn.is_isomorphic_subgraph.html" title="fn petgraph::algo::isomorphism::is_isomorphic_subgraph">is_isomorphic_subgraph</a>;</code></div></li><li><div class="item-name" id="reexport.is_isomorphic_subgraph_matching"><code>pub use isomorphism::<a class="fn" href="isomorphism/fn.is_isomorphic_subgraph_matching.html" title="fn petgraph::algo::isomorphism::is_isomorphic_subgraph_matching">is_isomorphic_subgraph_matching</a>;</code></div></li><li><div class="item-name" id="reexport.subgraph_isomorphisms_iter"><code>pub use isomorphism::<a class="fn" href="isomorphism/fn.subgraph_isomorphisms_iter.html" title="fn petgraph::algo::isomorphism::subgraph_isomorphisms_iter">subgraph_isomorphisms_iter</a>;</code></div></li><li><div class="item-name" id="reexport.k_shortest_path"><code>pub use k_shortest_path::<a class="fn" href="k_shortest_path/fn.k_shortest_path.html" title="fn petgraph::algo::k_shortest_path::k_shortest_path">k_shortest_path</a>;</code></div></li><li><div class="item-name" id="reexport.greedy_matching"><code>pub use matching::<a class="fn" href="matching/fn.greedy_matching.html" title="fn petgraph::algo::matching::greedy_matching">greedy_matching</a>;</code></div></li><li><div class="item-name" id="reexport.maximum_matching"><code>pub use matching::<a class="fn" href="matching/fn.maximum_matching.html" title="fn petgraph::algo::matching::maximum_matching">maximum_matching</a>;</code></div></li><li><div class="item-name" id="reexport.Matching"><code>pub use matching::<a class="struct" href="matching/struct.Matching.html" title="struct petgraph::algo::matching::Matching">Matching</a>;</code></div></li><li><div class="item-name" id="reexport.all_simple_paths"><code>pub use simple_paths::<a class="fn" href="simple_paths/fn.all_simple_paths.html" title="fn petgraph::algo::simple_paths::all_simple_paths">all_simple_paths</a>;</code></div></li></ul><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="astar/index.html" title="mod petgraph::algo::astar">astar</a></div></li><li><div class="item-name"><a class="mod" href="bellman_ford/index.html" title="mod petgraph::algo::bellman_ford">bellman_ford</a></div><div class="desc docblock-short">Bellman-Ford algorithms.</div></li><li><div class="item-name"><a class="mod" href="dijkstra/index.html" title="mod petgraph::algo::dijkstra">dijkstra</a></div></li><li><div class="item-name"><a class="mod" href="dominators/index.html" title="mod petgraph::algo::dominators">dominators</a></div><div class="desc docblock-short">Compute dominators of a control-flow graph.</div></li><li><div class="item-name"><a class="mod" href="feedback_arc_set/index.html" title="mod petgraph::algo::feedback_arc_set">feedback_arc_set</a></div></li><li><div class="item-name"><a class="mod" href="floyd_warshall/index.html" title="mod petgraph::algo::floyd_warshall">floyd_warshall</a></div></li><li><div class="item-name"><a class="mod" href="isomorphism/index.html" title="mod petgraph::algo::isomorphism">isomorphism</a></div></li><li><div class="item-name"><a class="mod" href="k_shortest_path/index.html" title="mod petgraph::algo::k_shortest_path">k_shortest_path</a></div></li><li><div class="item-name"><a class="mod" href="matching/index.html" title="mod petgraph::algo::matching">matching</a></div></li><li><div class="item-name"><a class="mod" href="simple_paths/index.html" title="mod petgraph::algo::simple_paths">simple_paths</a></div></li><li><div class="item-name"><a class="mod" href="tred/index.html" title="mod petgraph::algo::tred">tred</a></div><div class="desc docblock-short">Compute the transitive reduction and closure of a directed acyclic graph</div></li></ul><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Cycle.html" title="struct petgraph::algo::Cycle">Cycle</a></div><div class="desc docblock-short">An algorithm error: a cycle was found in the graph.</div></li><li><div class="item-name"><a class="struct" href="struct.DfsSpace.html" title="struct petgraph::algo::DfsSpace">DfsSpace</a></div><div class="desc docblock-short">Workspace for a graph traversal.</div></li><li><div class="item-name"><a class="struct" href="struct.MinSpanningTree.html" title="struct petgraph::algo::MinSpanningTree">MinSpanningTree</a></div><div class="desc docblock-short">An iterator producing a minimum spanning forest of a graph.</div></li><li><div class="item-name"><a class="struct" href="struct.NegativeCycle.html" title="struct petgraph::algo::NegativeCycle">NegativeCycle</a></div><div class="desc docblock-short">An algorithm error: a cycle of negative weights was found in the graph.</div></li><li><div class="item-name"><a class="struct" href="struct.TarjanScc.html" title="struct petgraph::algo::TarjanScc">TarjanScc</a></div><div class="desc docblock-short">A reusable state for computing the <em>strongly connected components</em> using <a href="https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm">Tarjan’s algorithm</a>.</div></li></ul><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.BoundedMeasure.html" title="trait petgraph::algo::BoundedMeasure">BoundedMeasure</a></div></li><li><div class="item-name"><a class="trait" href="trait.FloatMeasure.html" title="trait petgraph::algo::FloatMeasure">FloatMeasure</a></div><div class="desc docblock-short">A floating-point measure.</div></li><li><div class="item-name"><a class="trait" href="trait.Measure.html" title="trait petgraph::algo::Measure">Measure</a></div><div class="desc docblock-short">Associated data that can be used for measures (such as length).</div></li></ul><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.condensation.html" title="fn petgraph::algo::condensation">condensation</a></div><div class="desc docblock-short"><a href="../graph/struct.Graph.html" title="struct petgraph::graph::Graph">Graph</a> Condense every strongly connected component into a single node and return the result.</div></li><li><div class="item-name"><a class="fn" href="fn.connected_components.html" title="fn petgraph::algo::connected_components">connected_components</a></div><div class="desc docblock-short">[Generic] Return the number of connected components of the graph.</div></li><li><div class="item-name"><a class="fn" href="fn.has_path_connecting.html" title="fn petgraph::algo::has_path_connecting">has_path_connecting</a></div><div class="desc docblock-short">[Generic] Check if there exists a path starting at <code>from</code> and reaching <code>to</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.is_bipartite_undirected.html" title="fn petgraph::algo::is_bipartite_undirected">is_bipartite_undirected</a></div><div class="desc docblock-short">Return <code>true</code> if the graph is bipartite. A graph is bipartite if its nodes can be divided into
|
|
|
two disjoint and indepedent sets U and V such that every edge connects U to one in V. This
|
|
|
algorithm implements 2-coloring algorithm based on the BFS algorithm.</div></li><li><div class="item-name"><a class="fn" href="fn.is_cyclic_directed.html" title="fn petgraph::algo::is_cyclic_directed">is_cyclic_directed</a></div><div class="desc docblock-short">[Generic] Return <code>true</code> if the input directed graph contains a cycle.</div></li><li><div class="item-name"><a class="fn" href="fn.is_cyclic_undirected.html" title="fn petgraph::algo::is_cyclic_undirected">is_cyclic_undirected</a></div><div class="desc docblock-short">[Generic] Return <code>true</code> if the input graph contains a cycle.</div></li><li><div class="item-name"><a class="fn" href="fn.kosaraju_scc.html" title="fn petgraph::algo::kosaraju_scc">kosaraju_scc</a></div><div class="desc docblock-short">[Generic] Compute the <em>strongly connected components</em> using <a href="https://en.wikipedia.org/wiki/Kosaraju%27s_algorithm">Kosaraju’s algorithm</a>.</div></li><li><div class="item-name"><a class="fn" href="fn.min_spanning_tree.html" title="fn petgraph::algo::min_spanning_tree">min_spanning_tree</a></div><div class="desc docblock-short">[Generic] Compute a <em>minimum spanning tree</em> of a graph.</div></li><li><div class="item-name"><a class="fn" href="fn.scc.html" title="fn petgraph::algo::scc">scc</a><span class="stab deprecated" title="">Deprecated</span></div><div class="desc docblock-short">Renamed to <code>kosaraju_scc</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.tarjan_scc.html" title="fn petgraph::algo::tarjan_scc">tarjan_scc</a></div><div class="desc docblock-short">[Generic] Compute the <em>strongly connected components</em> using <a href="https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm">Tarjan’s algorithm</a>.</div></li><li><div class="item-name"><a class="fn" href="fn.toposort.html" title="fn petgraph::algo::toposort">toposort</a></div><div class="desc docblock-short">[Generic] Perform a topological sort of a directed graph.</div></li></ul></section></div></main></body></html> |