summaryrefslogtreecommitdiff
path: root/networkx/algorithms/similarity.py
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2019-10-17 19:46:32 -0700
committerJarrod Millman <jarrod.millman@gmail.com>2019-10-18 00:47:00 -0700
commitd50eef197f1e7f452dee8b85c2cec3039124f43c (patch)
tree215dac7ba13b99bd080b9ff9236e173e085beb01 /networkx/algorithms/similarity.py
parent6489993fc8a57d3ae903d3cff4f28484b5b54583 (diff)
downloadnetworkx-d50eef197f1e7f452dee8b85c2cec3039124f43c.tar.gz
Use yield from
Diffstat (limited to 'networkx/algorithms/similarity.py')
-rw-r--r--networkx/algorithms/similarity.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/networkx/algorithms/similarity.py b/networkx/algorithms/similarity.py
index 48fe552c..f558ba64 100644
--- a/networkx/algorithms/similarity.py
+++ b/networkx/algorithms/similarity.py
@@ -791,9 +791,8 @@ def optimize_edit_paths(G1, G2, node_match=None, edge_match=None,
continue
other.append(((i, j), Cv_ij, xy, Ce_xy, Cv.C[i, j] + localCe.ls))
- # yield from
- for t in sorted(other, key=lambda t: t[4] + t[1].ls + t[3].ls):
- yield t
+ yield from sorted(other, key=lambda t: t[4] + t[1].ls + t[3].ls)
+
def get_edit_paths(matched_uv, pending_u, pending_v, Cv,
matched_gh, pending_g, pending_h, Ce, matched_cost):
@@ -873,13 +872,11 @@ def optimize_edit_paths(G1, G2, node_match=None, edge_match=None,
H = list((pending_h.pop(y) if y < len(pending_h) else None)
for y in reversed(sortedy))
- # yield from
- for t in get_edit_paths(matched_uv, pending_u, pending_v,
- Cv_ij,
- matched_gh, pending_g, pending_h,
- Ce_xy,
- matched_cost + edit_cost):
- yield t
+ yield from get_edit_paths(matched_uv, pending_u, pending_v,
+ Cv_ij,
+ matched_gh, pending_g, pending_h,
+ Ce_xy,
+ matched_cost + edit_cost)
# backtrack
if u is not None: