diff --git a/src/graph.c b/src/graph.c
index 72de4f03..91b552ec 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -196,7 +196,7 @@ static void sssp_bfs(void) {
 
 			// Only update nexthop if it doesn't increase the path length
 
-			if(!e->to->status.visited || (e->to->distance == n->distance + 1 && e->weight <= e->to->prevedge->weight))
+			if(!e->to->status.visited || (e->to->distance == n->distance + 1 && e->weight >= e->to->prevedge->weight))
 				e->to->nexthop = (n->nexthop == myself) ? e->to : n->nexthop;
 
 			e->to->status.visited = true;