diff options
| author | Tim Blazytko <tim.blazytko@rub.de> | 2017-10-18 16:13:19 +0200 |
|---|---|---|
| committer | Tim Blazytko <tim.blazytko@rub.de> | 2017-10-18 16:26:07 +0200 |
| commit | 3419b0a920179e215c1e0ac33c958d4c428983c4 (patch) | |
| tree | 70146292150bd31b09e9d5d8411887362614c1f8 | |
| parent | 3bdad0fb8c2d4d2603aad1c689f106aaabb54efb (diff) | |
| download | miasm-3419b0a920179e215c1e0ac33c958d4c428983c4.tar.gz miasm-3419b0a920179e215c1e0ac33c958d4c428983c4.zip | |
DiGraph: fixed node order in natural loop backedges
| -rw-r--r-- | miasm2/core/graph.py | 2 | ||||
| -rw-r--r-- | test/core/graph.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py index c64c7b72..b74717da 100644 --- a/miasm2/core/graph.py +++ b/miasm2/core/graph.py @@ -523,7 +523,7 @@ class DiGraph(object): """ for a, b in self.compute_back_edges(head): body = self._compute_natural_loop_body(b, a) - yield ((b, a), body) + yield ((a, b), body) def compute_back_edges(self, head): """ diff --git a/test/core/graph.py b/test/core/graph.py index e148d70f..9f8afcae 100644 --- a/test/core/graph.py +++ b/test/core/graph.py @@ -184,8 +184,8 @@ g3.add_edge(7, 8) g3.add_edge(8, 7) loops = set([(backedge, frozenset(body)) for backedge, body in g3.compute_natural_loops(1)]) -assert(loops == {((1, 9), frozenset({1, 2, 4, 5, 9})), - ((2, 9), frozenset({2, 4, 5, 9}))}) +assert(loops == {((9, 1), frozenset({1, 2, 4, 5, 9})), + ((9, 2), frozenset({2, 4, 5, 9}))}) sccs = set([frozenset(scc) for scc in g3.compute_strongly_connected_components()]) assert(sccs == {frozenset({6}), |