From 530da97aec01cfc1a1a0132a4875ea62a746858e Mon Sep 17 00:00:00 2001 From: Ayaan Khan Date: Fri, 17 Jul 2020 20:49:00 +0530 Subject: [PATCH] fix: infinity --- graph/dijkstra.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graph/dijkstra.cpp b/graph/dijkstra.cpp index 3dca9e64a..9b47e446f 100644 --- a/graph/dijkstra.cpp +++ b/graph/dijkstra.cpp @@ -28,8 +28,9 @@ #include #include #include +#include -constexpr long long INF = 1000000000; +constexpr long long INF = std::numeric_limits::max(); /** * @namespace graph @@ -66,7 +67,7 @@ int dijkstra(std::vector>> *adj, int s, int t) { int n = adj->size(); /// setting all the distances initially to INF - std::vector dist(n, INF); + std::vector dist(n, INF); /// creating a min heap using priority queue /// first element of pair contains the distance