Skip to content

Commit

Permalink
if there are no edges, then raise an error
Browse files Browse the repository at this point in the history
  • Loading branch information
RazinShaikh committed Aug 1, 2024
1 parent e8a0de5 commit ac991dc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyzx/graph/multigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit ac991dc

Please sign in to comment.