Skip to content

Commit 1002eb5

Browse files
committed
fix: Eulerian path code fixed
1 parent acfd3fe commit 1002eb5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

SourceCodes/0003_Graph/0006_EulerianPathAndCircuit.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ namespace EulerianPathAndCircuit
3333
void Graph::DepthFirstSearch(Node* nodeU)
3434
{
3535
nodeU->visited = true;
36-
this->_eulerianPath.push_back(nodeU->data);
3736
for (auto& nodeV : this->_adjlist[nodeU])
3837
{
3938
if (nodeV->visited == false)

Tests/0003_Graph/0006_EulerianPathAndCircuitTest.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ namespace EulerianPathAndCircuit
2222
bool isEulerianPathPresent = graph.IsEulerianPathPresent();
2323
bool isEulerianCircuitPresent = graph.IsEulerianCircuitPresent();
2424

25-
vector<int> eulerianPath = graph.GetEulerianPath();
25+
vector<int> actualEulerianPath = graph.UndirectedGraphGetEulerianPath();
26+
vector<int> expectedEulerianPath = { 0, 1, 2, 0, 3, 4, 0};
2627

2728
ASSERT_TRUE(isEulerianPathPresent);
2829
ASSERT_TRUE(isEulerianCircuitPresent);
30+
EXPECT_EQ(expectedEulerianPath, actualEulerianPath);
2931
}
3032
}

0 commit comments

Comments
 (0)