Skip to content

Commit

Permalink
Add getindex(kp::EdgeDict, x::VertexPair)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou committed Jun 28, 2022
1 parent a0e2753 commit ad0f539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/algorithms/rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ function Base.get!(kp::EdgeDict{D}, x::VertexPair{D}) where D
end

Base.getindex(kp::EdgeDict, i::Integer) = kp.direct[i]
Base.getindex(kp::EdgeDict, x::VertexPair) = kp.reverse[x]

"""
unique_order(cycles)
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@ end
for (str, estr) in Iterators.take(zip(strs, estrs), 5)
@test issorted(estr)
for e in estr
@test get!(kp, kp[e]) == e
_e = kp[e]
@test get!(kp, _e) == kp[_e] == e
end
lenstr = length(str)
_edgestr = [minmax(str[i], str[mod1(i+1,lenstr)]) for i in 1:lenstr]
Expand Down

0 comments on commit ad0f539

Please sign in to comment.