Commit befefda
committed
Refactor
** Description of the problem **
`is_matched_graph` implementation is a bit confusing because is not
so easy to understand the comparison between the current graph and
the properties of the cached graphs. The usage of `continue` to
skip graphs of different sizes, and a combination of a `break` and
a flag to exit the inner loop to simulate a `continue` in the outer
loop, make it very difficult to follow the logic. Moreover, the
passed arguments and the function name do not match the intended
semantics properly.
** Proposed solution **
* Rename the function to `is_matched_graph_in_cache` to better
reflect its intention.
* Pass only the graph cache list instead of the whole context.
* Enclose the graph node traversal check inside a lambda to avoid
having to use statements that break the control flow arbitrarily.
* Rename variables in a more meaningful way.
* Update the corresponding function call.is_matched_graph for better maintainability1 parent 3659aa2 commit befefda
1 file changed
+26
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2199 | 2199 | | |
2200 | 2200 | | |
2201 | 2201 | | |
2202 | | - | |
2203 | | - | |
| 2202 | + | |
| 2203 | + | |
2204 | 2204 | | |
2205 | 2205 | | |
2206 | | - | |
2207 | | - | |
2208 | | - | |
2209 | | - | |
2210 | | - | |
2211 | | - | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
2212 | 2214 | | |
2213 | 2215 | | |
2214 | | - | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
2220 | 2221 | | |
2221 | 2222 | | |
2222 | 2223 | | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
2226 | 2233 | | |
2227 | 2234 | | |
2228 | 2235 | | |
2229 | 2236 | | |
| 2237 | + | |
2230 | 2238 | | |
2231 | 2239 | | |
2232 | 2240 | | |
| |||
2331 | 2339 | | |
2332 | 2340 | | |
2333 | 2341 | | |
2334 | | - | |
| 2342 | + | |
2335 | 2343 | | |
2336 | 2344 | | |
2337 | 2345 | | |
| |||
0 commit comments