diff --git a/evrouting/gasstation/routing.py b/evrouting/gasstation/routing.py
index b9462fcbe2a959336600c45064c87a5c448eec9b..c31ff3c20dd423f2627042a4981d1ec89909044d 100644
--- a/evrouting/gasstation/routing.py
+++ b/evrouting/gasstation/routing.py
@@ -1,5 +1,4 @@
 from typing import Set, Union, Callable, List
-
 import networkx as nx
 from evrouting.T import Node, SoC
 
@@ -21,10 +20,12 @@ def shortest_path(G: nx.Graph, s, t, b_0: float, b_t: float, U: float):
     pass
 
 
-def dijkstra(G: nx.Graph, u: Node, v: Node, weight: str = 'weight') -> Union[int, float]:
-    path: List[Node] = nx.algorithms.shortest_path(G, u, v, weight=weight)
-
-    return sum([G.edges[path[i], path[i + 1]][weight] for i in range(len(path) - 1)])
+def dijkstra(G: nx.Graph, u: Node, v: Node,
+             weight: str = 'weight') -> Union[int, float]:
+    length, _ = nx.algorithms.shortest_paths.single_source_dijkstra(
+        G, u, v, weight=weight
+    )
+    return length
 
 
 def contract_graph(G: nx.Graph, S: Set[Node], U: SoC,