diff options
| author | Ajax <commial@gmail.com> | 2016-01-25 10:59:48 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2016-01-25 14:28:41 +0100 |
| commit | 7e2ad0109bb191b7e83f4e779b39440664ce4b5c (patch) | |
| tree | 5476be7ee07aed87280ce4da6469eb8a08ca61b2 | |
| parent | 418d2f1600dd1b7dbe81537f9b24c1d4e2d450cb (diff) | |
| download | miasm-7e2ad0109bb191b7e83f4e779b39440664ce4b5c.tar.gz miasm-7e2ad0109bb191b7e83f4e779b39440664ce4b5c.zip | |
Graph: add_node return the previous status
| -rw-r--r-- | miasm2/core/graph.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py index ee5dc418..8199c22a 100644 --- a/miasm2/core/graph.py +++ b/miasm2/core/graph.py @@ -52,11 +52,16 @@ class DiGraph(object): sorted(self._edges) == sorted(graph.edges()))) def add_node(self, node): + """Add the node @node to the graph. + If the node was already present, return False. + Otherwise, return True + """ if node in self._nodes: - return + return False self._nodes.add(node) self._nodes_succ[node] = [] self._nodes_pred[node] = [] + return True def del_node(self, node): """Delete the @node of the graph; Also delete every edge to/from this |