Skip to content

Commit

Permalink
from SimpleWeightedEdge to Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorarossi committed Sep 12, 2022
1 parent a3fb98b commit c5b378f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spanningtrees/kruskal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function kruskal_mst end

connected_vs = IntDisjointSets(nv(g))

mst = Vector{edgetype(g)}()
mst = Vector{Edge{U}}()
sizehint!(mst, nv(g) - 1)

weights = Vector{T}()
Expand All @@ -27,7 +27,7 @@ function kruskal_mst end
for e in edge_list[sortperm(weights; rev=!minimize)]
if !in_same_set(connected_vs, src(e), dst(e))
union!(connected_vs, src(e), dst(e))
push!(mst, e)
push!(mst, Edge(src(e), dst(e)))
(length(mst) >= nv(g) - 1) && break
end
end
Expand Down

0 comments on commit c5b378f

Please sign in to comment.