From ac991dc6cd7944e097df04da327ab82239a50ad1 Mon Sep 17 00:00:00 2001 From: Razin Shaikh Date: Thu, 1 Aug 2024 19:03:35 +0100 Subject: [PATCH] if there are no edges, then raise an error --- pyzx/graph/multigraph.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyzx/graph/multigraph.py b/pyzx/graph/multigraph.py index 932ad93f..37e14817 100644 --- a/pyzx/graph/multigraph.py +++ b/pyzx/graph/multigraph.py @@ -336,6 +336,8 @@ def connected(self,v1,v2): def edge_type(self, e): if len(e) == 2: edges = list(self.edges(e[0],e[1])) + if len(edges) == 0: + raise ValueError('Edge not found') if len(edges) > 1: # if all edges are of the same type, return that type if all(e[2] == edges[0][2] for e in edges):