From 4d189f269c51fcee0fa5e10d7a7e5a055079166c Mon Sep 17 00:00:00 2001 From: stefiosif Date: Tue, 9 Aug 2022 00:22:21 +0300 Subject: [PATCH] Fix graph volume V() --- graph/graph.h | 1 + test/graph_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/graph/graph.h b/graph/graph.h index 7e2bae6..f688e96 100644 --- a/graph/graph.h +++ b/graph/graph.h @@ -45,6 +45,7 @@ Graph::~Graph() { template inline void Graph::insert(const T& u, const T& v) { Graph::adjMatrix[u].insert(v); + Graph::adjMatrix[v]; } template diff --git a/test/graph_test.cc b/test/graph_test.cc index 8365ea7..e6d957d 100644 --- a/test/graph_test.cc +++ b/test/graph_test.cc @@ -45,13 +45,13 @@ TEST_SUITE("Graph") { CHECK_EQ(R, X); } - TEST_CASE("Digraph::V and Digraph::E") { + TEST_CASE("Graph::V and Graph::E") { // 1 --> 2 --> 3 --> 1 // 3 --> 4 --> 5 --> 3 // 2 --> 6 --> 7 --> 8 --> 6 // 6 --> 9 --> 10 --> 11 --> 12 --> 13 --> 9 // 12 --> 10 - Digraph G; + Graph G; G.insert(1, 2); G.insert(2, 3); G.insert(3, 1);