From d2d333d8aa89dcf237c007821682e0f9f7318a3a Mon Sep 17 00:00:00 2001 From: "niehues.mark@gmail.com" <niehues.mark@gmail.com> Date: Mon, 30 Mar 2020 17:33:06 +0200 Subject: [PATCH] fix --- evrouting/gasstation/routing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evrouting/gasstation/routing.py b/evrouting/gasstation/routing.py index c38a0bb..1e3edbd 100644 --- a/evrouting/gasstation/routing.py +++ b/evrouting/gasstation/routing.py @@ -62,7 +62,7 @@ def contract_graph(G: nx.Graph, charging_stations: Set[Node], capacity: SoC, for cs in list(charging_stations): H.add_node(cs, **G.nodes[cs]) # Iterate unvisited charging stations - for n_cs in [n for n in charging_stations if (n, cs) not in H.edges]: + for n_cs in [n for n in charging_stations if (n, cs) not in H.edges and n != cs]: min_path: Path = dist(G, cs, n_cs) consumption: SoC = fold_path(G, min_path, weight=CONSUMPTION_KEY) if consumption <= capacity: -- GitLab