-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into shorter-dispatch
- Loading branch information
Showing
14 changed files
with
569 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
decorator==4.4.2 | ||
importlib-metadata==4.13.0;python_version<'3.8' | ||
pillow<10.0.0 |
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
42 changes: 42 additions & 0 deletions
42
releasenotes/notes/add-graph-greedy-edge-color-7ef35785e5768419.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,42 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new function, :func:`~.graph_line_graph` to construct a line | ||
graph of a :class:`~.PyGraph` object. | ||
The line graph `L(G)` of a graph `G` represents the adjacencies between edges of G. | ||
`L(G)` contains a vertex for every edge in `G`, and `L(G)` contains an edge between two | ||
vertices if the corresponding edges in `G` have a vertex in common. | ||
.. jupyter-execute:: | ||
import rustworkx as rx | ||
graph = rx.PyGraph() | ||
node_a = graph.add_node("a") | ||
node_b = graph.add_node("b") | ||
node_c = graph.add_node("c") | ||
node_d = graph.add_node("d") | ||
edge_ab = graph.add_edge(node_a, node_b, 1) | ||
edge_ac = graph.add_edge(node_a, node_c, 1) | ||
edge_bc = graph.add_edge(node_b, node_c, 1) | ||
edge_ad = graph.add_edge(node_a, node_d, 1) | ||
out_graph, out_edge_map = rx.graph_line_graph(graph) | ||
assert out_graph.node_indices() == [0, 1, 2, 3] | ||
assert out_graph.edge_list() == [(3, 1), (3, 0), (1, 0), (2, 0), (2, 1)] | ||
assert out_edge_map == {edge_ab: 0, edge_ac: 1, edge_bc: 2, edge_ad: 3} | ||
- | | ||
Added a new function, :func:`~.graph_greedy_edge_color` to color edges | ||
of a :class:`~.PyGraph` object using a greedy approach. | ||
This function works by greedily coloring the line graph of the given graph. | ||
.. jupyter-execute:: | ||
import rustworkx as rx | ||
graph = rx.generators.cycle_graph(7) | ||
edge_colors = rx.graph_greedy_edge_color(graph) | ||
assert edge_colors == {0: 0, 1: 1, 2: 0, 3: 1, 4: 0, 5: 1, 6: 2} |
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.