Skip to content

Commit

Permalink
Merge pull request #30 from mmiller-max/mm/Switch-to-Graphs
Browse files Browse the repository at this point in the history
Switch from LightGraphs to Graphs
  • Loading branch information
matbesancon authored Oct 20, 2021
2 parents 7d1fd84 + daf8b90 commit e15ade5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 4 additions & 4 deletions src/StaticGraphs.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module StaticGraphs

using LightGraphs
using Graphs
using JLD2
using SparseArrays

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,
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions src/overrides.jl
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/staticdigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand Down
2 changes: 1 addition & 1 deletion src/staticgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using StaticGraphs
using LightGraphs
using LightGraphs.SimpleGraphs
using Graphs
using Graphs.SimpleGraphs
using Test

const testdir = dirname(@__FILE__)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e15ade5

Please sign in to comment.