From a13f7f90743ccdf72e4e3196e666a23c26b896ec Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 4 Jan 2017 23:08:45 -0500 Subject: Note existence of out edges --- src/graph.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graph.h b/src/graph.h index b4b300b..7d0ae08 100644 --- a/src/graph.h +++ b/src/graph.h @@ -19,6 +19,7 @@ public: add_vertex(from); add_vertex(to); graph_[from].push_back(to); + has_out_edges_.insert(from); } const std::set & get_vertices() const { @@ -28,9 +29,14 @@ public: const std::vector & get_neighbors(int vertex) const { return graph_.find(vertex)->second; } + + bool has_out_edges(int vertex) const { + return has_out_edges_.count(vertex) > 0; + } private: std::set vertices_; std::map> graph_; + std::set has_out_edges_; }; #endif -- cgit v1.2.3