Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #252 from JuliaAttic/maintenance/julia1
Browse files Browse the repository at this point in the history
julia 1.0 and drop compat, increase DataStruct deps
  • Loading branch information
dehann authored Sep 30, 2018
2 parents c0a6416 + c0a60f0 commit b9bb971
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 46 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ notifications:
email: false
matrix:
allow_failures:
- julia: 1.0
- julia: nightly
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("Graphs"); Pkg.test("Graphs"; coverage=true)'
- julia --check-bounds=yes -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("Graphs"); Pkg.test("Graphs"; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("Graphs")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
- julia -e 'using Pkg; cd(Pkg.dir("Graphs")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
julia 0.7
DataStructures 0.9.0
Compat 1.1.0
DataStructures 0.14.0
2 changes: 1 addition & 1 deletion src/Graphs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
isdefined(Base, :__precompile__) && __precompile__()

module Graphs
using DataStructures, Compat
using DataStructures
using SparseArrays

import Base: start, done, next, show, ==, <
Expand Down
6 changes: 2 additions & 4 deletions src/a_star_spath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module AStar
# code in its own module.

using Graphs
# using Base. # in DataStructures? Julia 0.7.0
using Compat
using DataStructures

export shortest_path
Expand Down Expand Up @@ -63,8 +61,8 @@ function shortest_path(
t::V, # the end vertex
heuristic::Function = n -> 0) where {V,E,D} # heuristic (under)estimating distance to target
#
frontier = DataStructures.PriorityQueue{@compat(Tuple{D,Array{E,1},V}),D}()
# frontier = DataStructures.PriorityQueue(@compat(Tuple{D,Array{E,1},V}),D)
frontier = DataStructures.PriorityQueue{Tuple{D,Array{E,1},V},D}()
# frontier = DataStructures.PriorityQueue(Tuple{D,Array{E,1},V},D)
frontier[(zero(D), E[], s)] = zero(D)
colormap = zeros(Int, num_vertices(graph))
sindx = mkindx(s)
Expand Down
4 changes: 2 additions & 2 deletions src/adjacency_list.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mutable struct GenericAdjacencyList{V, VList, AdjList} <: AbstractGraph{V, Edge{
adjlist::AdjList
end

@compat const SimpleAdjacencyList = GenericAdjacencyList{Int, UnitRange{Int}, Vector{Vector{Int}}}
@compat const AdjacencyList{V} = GenericAdjacencyList{V, Vector{V}, Vector{Vector{V}}}
const SimpleAdjacencyList = GenericAdjacencyList{Int, UnitRange{Int}, Vector{Vector{Int}}}
const AdjacencyList{V} = GenericAdjacencyList{V, Vector{V}, Vector{Vector{V}}}

@graph_implements GenericAdjacencyList vertex_list vertex_map adjacency_list

Expand Down
2 changes: 1 addition & 1 deletion src/cliques.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function maximal_cliques(g::AbstractGraph{V}) where {V}
union!(cand, keys(nnbrs))
smallcand = setdiff(cand, pivotnbrs)
done = Set{V}()
stack = @compat(Tuple{Set{V}, Set{V}, Set{V}})[]
stack = Tuple{Set{V}, Set{V}, Set{V}}[]
clique_so_far = V[]
cliques = Array{V}[]

Expand Down
10 changes: 5 additions & 5 deletions src/common.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Common facilities

#typealias
@compat const AttributeDict = Dict{String, Any}
const AttributeDict = Dict{String, Any}

#################################################
#
Expand All @@ -22,7 +22,7 @@ vertex_index(v::KeyVertex) = v.index

mutable struct ExVertex
index::Int
label::String #Compat.UTF8String
label::String
attributes::AttributeDict

ExVertex(i::Int, label::AbstractString) = new(i, label, AttributeDict())
Expand All @@ -32,7 +32,7 @@ make_vertex(g::AbstractGraph{ExVertex}, label::AbstractString) = ExVertex(num_ve
vertex_index(v::ExVertex) = v.index
attributes(v::ExVertex, g::AbstractGraph) = v.attributes

@compat const ProvidedVertexType = @compat(Union{KeyVertex, ExVertex})
const ProvidedVertexType = Union{KeyVertex, ExVertex}

vertex_index(v::V, g::AbstractGraph{V}) where {V<:ProvidedVertexType} = vertex_index(v)

Expand All @@ -59,7 +59,7 @@ struct Edge{V}
target::V
Edge(i::Int, s::V, t::V) where {V} = new{V}(i, s, t)
end
@compat const IEdge = Edge{Int}
const IEdge = Edge{Int}

# Edge{V}(i::Int, s::V, t::V) = Edge{V}(i, s, t)
make_edge(g::AbstractGraph{V,E}, s::V, t::V) where {V,E<:Edge} = Edge(num_edges(g) + 1, s, t)
Expand Down Expand Up @@ -192,7 +192,7 @@ end
#
################################################

@compat abstract type AbstractEdgePropertyInspector{T} end
abstract type AbstractEdgePropertyInspector{T} end

# edge_property_requirement{T, V}(visitor::AbstractEdgePropertyInspector{T}, g::AbstractGraph{V}) = nothing

Expand Down
2 changes: 1 addition & 1 deletion src/concepts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#################################################

### the root type of all graphs
@compat abstract type AbstractGraph{V, E} end
abstract type AbstractGraph{V, E} end

vertex_type(g::AbstractGraph{V,E}) where {V,E} = V
edge_type(g::AbstractGraph{V,E}) where {V,E} = E
Expand Down
2 changes: 1 addition & 1 deletion src/dijkstra_spath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ end
#
###################################################################

@compat abstract type AbstractDijkstraVisitor end
abstract type AbstractDijkstraVisitor end

# invoked when a new vertex is first encountered
discover_vertex!(visitor::AbstractDijkstraVisitor, u, v, d) = nothing
Expand Down
4 changes: 2 additions & 2 deletions src/dot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
function to_dot(graph::AbstractGraph, attrs::AttributeDict=AttributeDict())
str = IOBuffer()
to_dot(graph, str, attrs)
@compat String(take!(str)) #takebuf_string(str)
String(take!(str)) #takebuf_string(str)
end

# Write the dot representation of a graph to a stream.
Expand Down Expand Up @@ -77,7 +77,7 @@ end

to_dot(attr::AbstractString, value) = "\"$attr\"=\"$value\""

to_dot(attr_tuple::@compat Tuple{String, Any}) = "\"$(attr_tuple[1])\"=\"$(attr_tuple[2])\""
to_dot(attr_tuple::Tuple{String, Any}) = "\"$(attr_tuple[1])\"=\"$(attr_tuple[2])\""

function graph_type_string(graph::AbstractGraph)
is_directed(graph) ? "digraph" : "graph"
Expand Down
4 changes: 2 additions & 2 deletions src/edge_list.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ end

@graph_implements GenericEdgeList vertex_list edge_list vertex_map edge_map

@compat const SimpleEdgeList{E} = GenericEdgeList{Int,E,UnitRange{Int},Vector{E}}
@compat const EdgeList{V,E} = GenericEdgeList{V,E,Vector{V},Vector{E}}
const SimpleEdgeList{E} = GenericEdgeList{Int,E,UnitRange{Int},Vector{E}}
const EdgeList{V,E} = GenericEdgeList{V,E,Vector{V},Vector{E}}

# construction

Expand Down
2 changes: 1 addition & 1 deletion src/generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function simple_wheel_graph(n::Integer; is_directed=true)
return g
end

function _make_simple_undirected_graph(n::T, edgelist::Vector{@compat Tuple{T,T}}) where {T<:Integer}
function _make_simple_undirected_graph(n::T, edgelist::Vector{Tuple{T,T}}) where {T<:Integer}
g = simple_graph(n, is_directed=false)
for (s,d) in edgelist
add_edge!(g,s,d)
Expand Down
4 changes: 2 additions & 2 deletions src/graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ end
# AdjList: Vector{Vector{Int}}
# IncList: Vector{Vector{IEdge}}
#
@compat const SimpleGraph = GenericGraph{Int,IEdge,UnitRange{Int},Vector{IEdge},Vector{Vector{IEdge}}}
const SimpleGraph = GenericGraph{Int,IEdge,UnitRange{Int},Vector{IEdge},Vector{Vector{IEdge}}}

@compat const Graph{V,E} = GenericGraph{V,E,Vector{V},Vector{E},Vector{Vector{E}}}
const Graph{V,E} = GenericGraph{V,E,Vector{V},Vector{E},Vector{Vector{E}}}

# construction

Expand Down
4 changes: 2 additions & 2 deletions src/graph_visit.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The concept and trivial implementation of graph visitors

@compat abstract type AbstractGraphVisitor end
abstract type AbstractGraphVisitor end

# trivial implementation

Expand All @@ -26,7 +26,7 @@ end


# This is the common base for BreadthFirst and DepthFirst
@compat abstract type AbstractGraphVisitAlgorithm end
abstract type AbstractGraphVisitAlgorithm end


###########################################################
Expand Down
6 changes: 3 additions & 3 deletions src/incidence_list.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ mutable struct GenericIncidenceList{V, E, VList, IncList} <: AbstractGraph{V, E}
inclist::IncList
end

@compat const SimpleIncidenceList = GenericIncidenceList{Int, IEdge, UnitRange{Int}, Vector{Vector{IEdge}}}
@compat const IncidenceList{V,E} = GenericIncidenceList{V, E, Vector{V}, Vector{Vector{E}}}
const SimpleIncidenceList = GenericIncidenceList{Int, IEdge, UnitRange{Int}, Vector{Vector{IEdge}}}
const IncidenceList{V,E} = GenericIncidenceList{V, E, Vector{V}, Vector{Vector{E}}}

@graph_implements GenericIncidenceList vertex_list vertex_map edge_map adjacency_list incidence_list

Expand All @@ -34,7 +34,7 @@ inclist(vs::Vector{V}; is_directed::Bool = true) where {V} = inclist(vs, Edge{V}
inclist(::Type{V}; is_directed::Bool = true) where {V} = inclist(V[], Edge{V}; is_directed=is_directed)

# First constructors on Dict Inc List version (reusing GenericIncidenceList container and functions, few dispatch changes required)
@compat const IncidenceDict{V,E} = GenericIncidenceList{V, E, Dict{Int,V}, Dict{Int,Vector{E}}}
const IncidenceDict{V,E} = GenericIncidenceList{V, E, Dict{Int,V}, Dict{Int,Vector{E}}}
incdict(vs::Dict{Int,V}, ::Type{E}; is_directed::Bool = true) where {V,E} =
IncidenceDict{V,E}(is_directed, vs, 0, Dict{Int, E}())
incdict(::Type{V}; is_directed::Bool = true) where {V} = incdict(Dict{Int,V}(), Edge{V}; is_directed=is_directed)
Expand Down
2 changes: 1 addition & 1 deletion src/maximum_adjacency_visit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
mutable struct MaximumAdjacency <: AbstractGraphVisitAlgorithm
end

@compat abstract type AbstractMASVisitor <: AbstractGraphVisitor end
abstract type AbstractMASVisitor <: AbstractGraphVisitor end
# @static if VERSION > v"0.6-"
# abstract type AbstractMASVisitor <: AbstractGraphVisitor end
# else
Expand Down
2 changes: 1 addition & 1 deletion src/prim_mst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
#
###################################################################

@compat abstract type AbstractPrimVisitor end
abstract type AbstractPrimVisitor end

# invoked when a new vertex is first encountered
discover_vertex!(visitor::AbstractPrimVisitor, v, e, w) = nothing
Expand Down
2 changes: 1 addition & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function show(io::IO, v::ExVertex)
end
end

function show(io::IO, e::@compat(Union{Edge, ExEdge}))
function show(io::IO, e::Union{Edge, ExEdge})
print(io, "edge [$(e.index)]: $(e.source) -- $(e.target)")
end

Expand Down
2 changes: 0 additions & 2 deletions test/dot.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Graphs
using Test

import Compat: xor

function has_match(regex, str)
match(regex, str) !== nothing
end
Expand Down
3 changes: 1 addition & 2 deletions test/dot2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
# NOTE: if to_dot is modified to emit lines with .dot comments, these tests
# mail fail erroneously....

using Compat

comRX = Base.compile(r"^[^\[]+\[([^\[]+)\]\h*$"x)
function rewriteAttrs(a::AbstractString)
Expand Down Expand Up @@ -89,7 +88,7 @@ end # module testDOT1

module testDOT2

using Graphs, Compat
using Graphs
using Test

###########
Expand Down
2 changes: 1 addition & 1 deletion test/edgelist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ gu = simple_edgelist(5, eds; is_directed=false)

## edge list (based on vector of vertices)

for T in [ ExVertex, String ] # Compat.ASCIIString
for T in [ ExVertex, String ]
g = edgelist(T[], ExEdge{T}[])

vs = [ add_vertex!(g, "a"),
Expand Down
2 changes: 1 addition & 1 deletion test/graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ end

@testset "Extended and General directed graph" begin

for T in [ExVertex, String] #Compat.ASCIIString
for T in [ExVertex, String]

#################################################
#
Expand Down
5 changes: 2 additions & 3 deletions test/inclist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ add_edge!(gd, 4, 5)
@test collect(out_edges(2, gd)) == [Edge(2, 2, 4), Edge(5, 2, 3)]
@test collect(out_edges(3, gd)) == [Edge(4, 3, 4)]
@test collect(out_edges(4, gd)) == [Edge(6, 4, 5)]
@test collect(out_edges(5, gd)) == Array{Tuple{Int, Int}}(undef, 0) # Array{@compat(Tuple{Int, Int})}(0)
# @test collect(out_edges(5, gd)) == Array(@compat(Tuple{Int, Int}), 0)
@test collect(out_edges(5, gd)) == Array{Tuple{Int, Int}}(undef, 0)

# import Graphs: iterate
# iter_state = iterate(out_neighbors(1, gd))
Expand Down Expand Up @@ -139,7 +138,7 @@ add_edge!(gu, 4, 5)
#################################################
global g
g = let g = g
for g in [inclist(KeyVertex{String}), inclist(String)] # Compat.ASCIIString, Compat.ASCIIString
for g in [inclist(KeyVertex{String}), inclist(String)]

global vs = [ add_vertex!(g, "a"), add_vertex!(g, "b"), add_vertex!(g, "c") ]

Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Compat
# import Compat.String


tests = [
"edgelist",
Expand Down

0 comments on commit b9bb971

Please sign in to comment.