Skip to content

Commit 516f8e8

Browse files
committed
Check edge exists
1 parent 776e1bf commit 516f8e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/abstractitensornetwork.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ function gauge_edge(
603603
# # TODO: Implement as `only(common_neighbors(tn, src(edge), dst(edge)))`
604604
# new_vertex = only(neighbors(tn, src(edge)) ∩ neighbors(tn, dst(edge)))
605605
# return contract(tn, new_vertex => dst(edge))
606+
@assert src(edge) neighbors(tn, dst(edge))
606607
tn = copy(tn)
607608
left_inds = uniqueinds(tn, edge)
608609
ltags = tags(tn, edge)
@@ -677,6 +678,7 @@ end
677678

678679
# TODO: decide whether to use graph mutating methods when resulting graph is unchanged?
679680
function _truncate_edge(tn::AbstractITensorNetwork, edge::AbstractEdge; kwargs...)
681+
@assert src(edge) neighbors(tn, dst(edge))
680682
tn = copy(tn)
681683
left_inds = uniqueinds(tn, edge)
682684
ltags = tags(tn, edge)

0 commit comments

Comments
 (0)