clean up createGraph function

This commit is contained in:
Jonas Seiler 2023-06-16 10:50:56 +02:00
parent 7fd1d68148
commit 78c5cd5639

View File

@ -20,11 +20,11 @@ end
function createGraph(words::Vector{String}) function createGraph(words::Vector{String})
graph = Vector{node}() graph = Vector{node}()
for w in words for w in words
_, me = binarySearch(w, words) _, myself = binarySearch(w, words)
neighbours = Vector{Int}() neighbours = Vector{Int}()
for x in HammingNeighbours(w) for x in LevenshteinNeighbours(w)
exists, index = binarySearch(x, words) exists, index = binarySearch(x, words)
if exists && index != me if exists && index != myself
push!(neighbours, index) push!(neighbours, index)
end end
end end