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

Switch from LightGraphs to Graphs #30

Merged
merged 5 commits into from
Oct 20, 2021
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: 0 additions & 1 deletion .codecov.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper

on:
schedule:
- cron: 0 * * * *

jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
12 changes: 12 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: TagBot
on:
schedule:
- cron: 30 * * * *
workflow_dispatch:
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# StaticGraphs

[![Build Status](https://travis-ci.org/JuliaGraphs/StaticGraphs.jl.svg?branch=master)](https://travis-ci.org/JuliaGraphs/StaticGraphs.jl)

[![Build Status](https://github.com/JuliaGraphs/StaticGraphs.jl/workflows/CI/badge.svg)](https://github.com/JuliaGraphs/StaticGraphs.jl/actions?query=workflow%3ACI+branch%3Amaster)
[![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