Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move broken Parallel.gdistances function to Experimental submodule #94

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Experimental/Experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description() = "This module contains experimental graph functions."

include("isomorphism.jl")
include("vf2.jl") # Julian implementation of VF2 algorithm
include("Parallel/Parallel.jl")
include("Traversals/Traversals.jl")
include("ShortestPaths/ShortestPaths.jl")

Expand Down
8 changes: 8 additions & 0 deletions src/Experimental/Parallel/Parallel.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Parallel

using Graphs
using Base.Threads: @threads, nthreads

include("traversals/gdistances.jl")

end
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

# TODO the algorithms in this file probably relay on incorrect assumptions
# about the memory handling of Julia.
# See: https://github.com/JuliaGraphs/Graphs.jl/issues/10

"""
partition_sources!(queue_list, sources)

Expand Down Expand Up @@ -40,6 +45,8 @@ function gdistances!(
queue_segment_size::Integer=20
) where T <:Integer

@warn "Graphs.Experimental.Parallel.gdistances is very likely broken at the moment and can return unreliable results."

nvg = nv(g)
n_t = nthreads()
segment_size = convert(T, queue_segment_size) # Type stability
Expand Down
1 change: 0 additions & 1 deletion src/Parallel/Parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ include("centrality/radiality.jl")
include("centrality/stress.jl")
include("distance.jl")
include("traversals/bfs.jl")
include("traversals/gdistances.jl")
include("traversals/greedy_color.jl")
include("utils.jl")
include("dominatingset/minimal_dom_set.jl")
Expand Down
2 changes: 1 addition & 1 deletion test/experimental/experimental.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const exptestdir = dirname(@__FILE__)
tests = ["isomorphism", "shortestpaths", "traversals"]
tests = ["isomorphism", "parallel/runtests", "shortestpaths", "traversals"]

@testset "Experimental" begin
@test length(description()) > 1
Expand Down
14 changes: 14 additions & 0 deletions test/experimental/parallel/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#using Graphs
#using Graphs.Parallel
#using Base.Threads: @threads, Atomic

tests = [
# "traversals/gdistances", # TODO currently disabled as the code in gdistances seems to be broken
]

@testset "Graphs.Experimental.Parallel" begin
for t in tests
tp = joinpath(dirname(@__FILE__), "$(t).jl")
include(tp)
end
end
19 changes: 19 additions & 0 deletions test/experimental/parallel/traversals/gdistances.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@testset "Experimental.Parallel.BFS" begin


g5 = SimpleDiGraph(4)
add_edge!(g5, 1, 2); add_edge!(g5, 2, 3); add_edge!(g5, 1, 3); add_edge!(g5, 3, 4)

for g in testdigraphs(g5)
@test @inferred(Experimental.Parallel.gdistances(g, 1)) == gdistances(g, 1)
@test @inferred(Experimental.Parallel.gdistances(g, [1, 3])) == gdistances(g, [1, 3])
end

g6 = smallgraph(:house)

for g in testgraphs(g6)
@test @inferred(Experimental.Parallel.gdistances(g, 2)) == gdistances(g, 2)
@test @inferred(Experimental.Parallel.gdistances(g, [1, 2])) == gdistances(g, [1, 2])
end

end
1 change: 0 additions & 1 deletion test/parallel/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ tests = [
"shortestpaths/floyd-warshall",
"shortestpaths/johnson",
"traversals/bfs",
"traversals/gdistances",
"traversals/greedy_color",
"dominatingset/minimal_dom_set",
"independentset/maximal_ind_set",
Expand Down
19 changes: 0 additions & 19 deletions test/parallel/traversals/gdistances.jl

This file was deleted.