-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to return the bridges of the graph (#1058)
* rename release note * fix inconsistent func signature * single pass of topo sort to check cycles * add interface of `bridges` * impl bridges and add tests * Use internal function to avoid breaking change * add bridges to documentation * Resolve indentation error * Run cargo fmt --------- Co-authored-by: Ivan Carvalho <[email protected]>
- Loading branch information
1 parent
e8e380b
commit 6931377
Showing
8 changed files
with
226 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
releasenotes/notes/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new function, :func:`~rustworkx.bridges` that finds the bridges of | ||
an undirected :class:`~rustworkx.PyGraph`. | ||
Bridges are edges that, if removed, would increase the number of connected | ||
components of a graph. For example: | ||
.. jupyter-execute:: | ||
import rustworkx | ||
from rustworkx.visualization import mpl_draw | ||
graph = rustworkx.PyGraph() | ||
graph.extend_from_edge_list([ | ||
(0, 1), (1, 2), (0, 2), (1, 3) | ||
]) | ||
bridges = rustworkx.bridges(graph) | ||
bridges_set = [set(edge) for edge in bridges] | ||
colors = [] | ||
for edge in graph.edge_list(): | ||
color = "red" if set(edge) in bridges_set else "black" | ||
colors.append(color) | ||
mpl_draw(graph, edge_color=colors) | ||
- | | ||
Added a new function ``bridges`` to the ``rustworkx_core:connectivity:biconnected`` | ||
module that finds the bridges of an undirected graph. | ||
Bridges are edges that, if removed, would increase the number of connected | ||
components of a graph. For example: | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.