Skip to content

Commit

Permalink
remove TreeBFSVisitor : end deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Apr 12, 2016
1 parent 7d5e2d9 commit 13a9676
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
16 changes: 0 additions & 16 deletions src/traversals/bfs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ end
# Constructing BFS trees #
###########################################

# this type has been deprecated in favor of TreeBFSVisitorVector and the tree function.
"""TreeBFSVisitor is a type for representing a BFS traversal of the graph as a DiGraph"""
type TreeBFSVisitor <:SimpleGraphVisitor
tree::DiGraph
end

@deprecate TreeBFSVisitor(x) TreeBFSVisitorVector(x)

"""TreeBFSVisitorVector is a type for representing a BFS traversal
of the graph as a parents array. This type allows for a more performant implementation.
"""
Expand All @@ -134,14 +126,6 @@ function TreeBFSVisitorVector(n::Int)
return TreeBFSVisitorVector(zeros(Int, n))
end

"""TreeBFSVisitor converts a parents array into a DiGraph"""
function TreeBFSVisitor(tvv::TreeBFSVisitorVector)
n = length(tvv.tree)
parents = tvv.tree
g = tree(parents)
return TreeBFSVisitor(g)
end

"""tree converts a parents array into a DiGraph"""
function tree(parents::AbstractVector)
n = length(parents)
Expand Down
13 changes: 1 addition & 12 deletions test/traversals/bfs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ add_edge!(g,3,4)
@test is_bipartite(g)


import LightGraphs: TreeBFSVisitorVector, bfs_tree!, TreeBFSVisitor, tree
import LightGraphs: TreeBFSVisitorVector, bfs_tree!, tree

function istree(parents::Vector{Int}, maxdepth)
flag = true
Expand All @@ -43,13 +43,8 @@ parents = visitor.tree
bfs_tree!(visitor, g, 1)

@test istree(parents, n) == true
tvis = TreeBFSVisitor(visitor)
@test nv(tvis.tree) == nv(g)
@test typeof(tvis.tree) <: DiGraph
t = tree(parents)
@test typeof(t) <: DiGraph
@test typeof(tvis.tree) <: DiGraph
@test t == tvis.tree
@test ne(t) < nv(t)

# test Dict{Int,Int}() colormap
Expand All @@ -61,16 +56,10 @@ parents = visitor.tree
bfs_tree!(visitor, g, 1, vertexcolormap = Dict{Int,Int}())

@test istree(parents, n) == true
tvis = TreeBFSVisitor(visitor)
@test nv(tvis.tree) == nv(g)
@test typeof(tvis.tree) <: DiGraph
t = tree(parents)
@test typeof(t) <: DiGraph
@test typeof(tvis.tree) <: DiGraph
@test t == tvis.tree
@test ne(t) < nv(t)


g10 = CompleteGraph(10)
@test bipartite_map(g10) == Vector{Int}()

Expand Down

0 comments on commit 13a9676

Please sign in to comment.