-
Notifications
You must be signed in to change notification settings - Fork 139
/
bugfix-union-7da79789134a3028.yaml
33 lines (30 loc) · 1.47 KB
/
bugfix-union-7da79789134a3028.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
fixes:
- |
Previously, :func:`~retworkx.digraph_union` would incorrectly keep or delete edges
if argument ``merge_edges`` is set to true. This has been fixed and an edge from
the second graph will be skipped if both its endpoints were merged to nodes from
the first graph and these nodes already share an edge with equal weight data.
Fixed `#432 <https://github.com/Qiskit/retworkx/issues/432>`__
features:
- |
Add a new function :func:`~retworkx.graph_union` that returns the union
of two :class:`~retworkx.PyGraph` objects. This is the equivalent to
:func:`~retworkx.digraph_union` but for a :class:`~retworkx.PyGraph`
instead of for a :class:`~retworkx.PyDiGraph`. A new unified function
:func:`~retworkx.union` was also added that supports both
:class:`~retworkx.PyDiGraph` and :class:`~retworkx.PyGraph`.
For example:
.. jupyter-execute::
import retworkx
from retworkx.visualization import mpl_draw
first = retworkx.generators.path_graph(3, weights=["a_0", "node", "a_1"])
second = retworkx.generators.cycle_graph(3, weights=["node", "b_0", "b_1"])
graph = retworkx.graph_union(first, second, merge_nodes=True)
mpl_draw(graph)
- |
The kwargs ``merge_nodes`` and ``merge_edges`` of :func:`~retworkx.digraph_union` are
now optional and by default are set `False`.
- |
Add a new :meth:`~retworkx.PyGraph.find_node_by_weight` that finds the index
of a node given a specific weight.