diff --git a/graph.cpp b/graph.cpp index 5041d36..16b5710 100644 --- a/graph.cpp +++ b/graph.cpp @@ -23,6 +23,8 @@ */ #include +#include + // Anonymous name spaces may be used to show the reader // that a function will only be used in the current file. namespace diff --git a/graph.hpp b/graph.hpp index 5622327..8b71861 100644 --- a/graph.hpp +++ b/graph.hpp @@ -40,6 +40,7 @@ */ #include +#include /** * Namespaces can be used in order to make sure different modules, * possibly implemented by different people don't have classes/functions/... @@ -238,18 +239,21 @@ Node & Graph::node(NodeId const id) inline NodeId Graph::matched_neighbor(NodeId const id) const { + assert(id <= num_nodes()); return _nodes[id].matched_neighbor; } inline NodeId Graph::ear_or_root_neighbor(const ED::NodeId id) const { + assert(id <= num_nodes()); return _nodes[id].ear_or_root_neighbor; } inline NodeId Graph::root_of_ear_component(const ED::NodeId id) const { + assert(id <= num_nodes()); return _nodes[id].root_of_ear_component; }