about summary refs log tree commit diff stats
path: root/miasm2/core
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/core')
-rw-r--r--miasm2/core/graph.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py
index 49fc0817..f38f71d6 100644
--- a/miasm2/core/graph.py
+++ b/miasm2/core/graph.py
@@ -1,5 +1,6 @@
 from collections import defaultdict, namedtuple
 
+
 class DiGraph(object):
     """Implementation of directed graph"""
 
@@ -25,6 +26,12 @@ class DiGraph(object):
     def edges(self):
         return self._edges
 
+    def __eq__(self, graph):
+        if not isinstance(graph, self.__class__):
+            return False
+        return all((self._nodes == graph.nodes(),
+                    sorted(self._edges) == sorted(graph.edges())))
+
     def add_node(self, node):
         if node in self._nodes:
             return