From b5f563a1de635878b6ac250f4bc5a95a3b0be201 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Tue, 2 Oct 2018 11:37:19 +0200 Subject: [PATCH] Add access to the number of nodes of the graph --- src/utils/CSRGraph.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/CSRGraph.hpp b/src/utils/CSRGraph.hpp index 1581a8528..2ae461eb0 100644 --- a/src/utils/CSRGraph.hpp +++ b/src/utils/CSRGraph.hpp @@ -10,6 +10,12 @@ class CSRGraph Array<int> m_neighbors; public: + size_t numberOfNodes() const + { + Assert(m_entries.size()>0); + return m_entries.size()-1; + } + const Array<int>& entries() const { return m_entries; @@ -28,7 +34,7 @@ class CSRGraph : m_entries(entries), m_neighbors(neighbors) { - ; + Assert(m_entries.size()>0); } CSRGraph() = default; -- GitLab