diff --git a/Project.toml b/Project.toml index b6bc5be..0d77389 100644 --- a/Project.toml +++ b/Project.toml @@ -1,16 +1,16 @@ name = "StaticGraphs" uuid = "4c8beaf5-199b-59a0-a7f2-21d17de635b6" -version = "0.2.1" +version = "0.3.0" [deps] +Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" -LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] -LightGraphs = "1" -julia = "1" +Graphs = "1.4" JLD2 = "0.1 - 0.4" +julia = "1" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/README.md b/README.md index 49cc164..3a0292d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,6 @@ [![codecov.io](http://codecov.io/github/JuliaGraphs/StaticGraphs.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaGraphs/StaticGraphs.jl?branch=master) Memory-efficient, performant graph structures optimized for large networks. -Uses [LightGraphs](https://github.com/JuliaGraphs/LightGraphs.jl). +Uses [Graphs](https://github.com/JuliaGraphs/Graphs.jl). Note: adding/removing edges and vertices is not supported with this graph type. diff --git a/src/StaticGraphs.jl b/src/StaticGraphs.jl index 31c1454..eda5cb8 100644 --- a/src/StaticGraphs.jl +++ b/src/StaticGraphs.jl @@ -1,6 +1,6 @@ module StaticGraphs -using LightGraphs +using Graphs using JLD2 using SparseArrays @@ -8,14 +8,14 @@ import Base: convert, eltype, show, ==, Pair, Tuple, in, copy, length, issubset, zero, one, size, getindex, setindex!, length, IndexStyle -import LightGraphs: +import Graphs: _NI, AbstractEdge, AbstractEdgeIter, src, dst, edgetype, nv, ne, vertices, edges, is_directed, has_vertex, has_edge, inneighbors, outneighbors, indegree, outdegree, degree, insorted, squash, AbstractGraphFormat, loadgraph, savegraph, reverse -import LightGraphs.SimpleGraphs: +import Graphs.SimpleGraphs: AbstractSimpleGraph, fadj, badj, @@ -103,7 +103,7 @@ include("persistence.jl") const SGraph = StaticGraph const SDiGraph = StaticDiGraph -const StaticEdgeIter{G} = LightGraphs.SimpleGraphs.SimpleEdgeIter{G} +const StaticEdgeIter{G} = Graphs.SimpleGraphs.SimpleEdgeIter{G} eltype(::Type{StaticEdgeIter{StaticGraph{T, U}}}) where T where U = StaticGraphEdge{T} eltype(::Type{StaticEdgeIter{StaticDiGraph{T, U}}}) where T where U = StaticDiGraphEdge{T} diff --git a/src/overrides.jl b/src/overrides.jl index 3fe0eed..ec5f359 100644 --- a/src/overrides.jl +++ b/src/overrides.jl @@ -1,5 +1,5 @@ -import LightGraphs.LinAlg: adjacency_matrix -import LightGraphs: induced_subgraph +import Graphs.LinAlg: adjacency_matrix +import Graphs: induced_subgraph adjacency_matrix(g::StaticGraph{I,U}, T::DataType; dir = :out!) where I<:Integer where U<:Integer = SparseMatrixCSC{T,I}(nv(g), nv(g), g.f_ind, g.f_vec, ones(T, ne(g)*2)) diff --git a/src/staticdigraph.jl b/src/staticdigraph.jl index 64c5dd6..7d8ed89 100644 --- a/src/staticdigraph.jl +++ b/src/staticdigraph.jl @@ -53,7 +53,7 @@ function StaticDiGraph(nvtx::I, f_sd::Vector{Tuple{T, T}}, b_sd::Vector{Tuple{T, return StaticDiGraph(nvtx, f_ss, f_ds, b_ss, b_ds) end -function StaticDiGraph(g::LightGraphs.SimpleGraphs.SimpleDiGraph) +function StaticDiGraph(g::Graphs.SimpleGraphs.SimpleDiGraph) ne(g) == 0 && return StaticDiGraph(nv(g), Array{Tuple{UInt8, UInt8},1}(), Array{Tuple{UInt8, UInt8},1}()) f_sd = [Tuple(e) for e in edges(g)] b_sd = sort([Tuple(reverse(e)) for e in edges(g)]) diff --git a/src/staticgraph.jl b/src/staticgraph.jl index 0d36b90..3338cd1 100644 --- a/src/staticgraph.jl +++ b/src/staticgraph.jl @@ -35,7 +35,7 @@ function StaticGraph(nvtx::I, sd::Vector{Tuple{T, T}}) where {T<:Integer, I<:Int return StaticGraph(nvtx, ss, ds) end -function StaticGraph(g::LightGraphs.SimpleGraphs.SimpleGraph) +function StaticGraph(g::Graphs.SimpleGraphs.SimpleGraph) ne(g) == 0 && return StaticGraph(nv(g), Array{Tuple{UInt8, UInt8},1}()) sd1 = [Tuple(e) for e in edges(g)] ds1 = [Tuple(reverse(e)) for e in edges(g)] diff --git a/test/runtests.jl b/test/runtests.jl index 7f56167..d770e89 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using StaticGraphs -using LightGraphs -using LightGraphs.SimpleGraphs +using Graphs +using Graphs.SimpleGraphs using Test const testdir = dirname(@__FILE__) @@ -67,10 +67,10 @@ const testdir = dirname(@__FILE__) # empty constructors @test nv(gempty) === 0x00 - @test typeof(LightGraphs.nv(gempty)) == UInt8 - @test length(LightGraphs.edges(gempty)) === 0x00 + @test typeof(Graphs.nv(gempty)) == UInt8 + @test length(Graphs.edges(gempty)) === 0x00 @test nv(gdempty) === 0x00 - @test length(LightGraphs.edges(gdempty)) === 0x00 + @test length(Graphs.edges(gdempty)) === 0x00 end # staticgraph