From 307fe682eff25a5a0221438f950a340cf0defa05 Mon Sep 17 00:00:00 2001 From: Brandon Taylor Date: Fri, 29 Oct 2021 11:58:23 -0400 Subject: [PATCH] switch to Graphs.jl --- .github/workflows/CompatHelper.yml | 30 +++++++++++++++++++ .github/workflows/TagBot.yml | 14 +++++++++ .github/workflows/daily.yml | 15 ---------- .github/workflows/permanent.yml | 5 ---- .github/workflows/test.yml | 6 +--- Project.toml | 6 ++-- README.md | 2 +- docs/make.jl | 2 +- docs/src/api.md | 4 +-- docs/src/index.md | 2 +- docs/src/tutorial_basics.md | 4 +-- docs/src/tutorial_files.md | 2 +- ...rial_lightgraphs.md => tutorial_graphs.md} | 16 +++++----- src/MetaGraphsNext.jl | 8 ++--- src/dict_utils.jl | 4 +-- src/{lightgraphs.jl => graphs.jl} | 0 16 files changed, 70 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/CompatHelper.yml create mode 100644 .github/workflows/TagBot.yml delete mode 100644 .github/workflows/daily.yml rename docs/src/{tutorial_lightgraphs.md => tutorial_graphs.md} (77%) rename src/{lightgraphs.jl => graphs.jl} (100%) diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..a134c8a --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,30 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..4b10a57 --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,14 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml deleted file mode 100644 index 55a7028..0000000 --- a/.github/workflows/daily.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: daily -on: - schedule: - - cron: '00 00 * * *' -jobs: - CompatHelper: - runs-on: ubuntu-latest - steps: - - uses: julia-actions/setup-julia@latest - with: - version: 1.3 - - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - run: julia -e 'using CompatHelper; CompatHelper.main()' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/permanent.yml b/.github/workflows/permanent.yml index 256b4ae..a9afa94 100644 --- a/.github/workflows/permanent.yml +++ b/.github/workflows/permanent.yml @@ -9,11 +9,6 @@ jobs: steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest - with: - version: '1.3' - uses: julia-actions/julia-docdeploy@releases/v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: JuliaRegistries/TagBot@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1c09bf..e5110fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: matrix: version: - '1.0' - - '1.4' + - '1' - 'nightly' steps: - uses: actions/checkout@v2 @@ -25,7 +25,3 @@ jobs: - uses: codecov/codecov-action@v1 with: file: ./lcov.info - - uses: domluna/JuliaFormatter-action@master - with: - args: -v . - continue-on-error: true diff --git a/Project.toml b/Project.toml index a2348c6..42f2275 100644 --- a/Project.toml +++ b/Project.toml @@ -1,14 +1,14 @@ name = "MetaGraphsNext" uuid = "fa8bd995-216d-47f1-8a91-f3b68fbeb377" -version = "0.1.2" +version = "0.2" [deps] JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" -LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" +Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" [compat] JLD2 = "0.1.11, 0.2, 0.3, 0.4" -LightGraphs = "1.2" +Graphs = "1.4.1" julia = "1" [extras] diff --git a/README.md b/README.md index 5748792..d8cbbde 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,4 @@ Welcome to `MetaGraphsNext.jl`, an experimental, type-stable replacement for [Me ## Getting started -To see how the package works, take a look at the tutorial in the [documentation](https://juliagraphs.org/MetaGraphsNext.jl/dev/). We first explain [the basics](tutorial_basics.md) of the `MetaGraph` structure, before moving on to its [integration](tutorial_lightgraphs.md) with `LightGraphs.jl`. +To see how the package works, take a look at the tutorial in the [documentation](https://juliagraphs.org/MetaGraphsNext.jl/dev/). We first explain [the basics](tutorial_basics.md) of the `MetaGraph` structure, before moving on to its [integration](tutorial_graphs.md) with `Graphs.jl`. diff --git a/docs/make.jl b/docs/make.jl index ed3d157..1f85a93 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,7 +14,7 @@ makedocs( "Home" => "index.md", "Tutorial" => [ "Basics" => "tutorial_basics.md", - "LightGraphs.jl interface" => "tutorial_lightgraphs.md", + "Graphs.jl interface" => "tutorial_graphs.md", "Reading / writing" => "tutorial_files.md", ], "API reference" => "api.md", diff --git a/docs/src/api.md b/docs/src/api.md index 2806ef5..21ee4ed 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -22,11 +22,11 @@ Modules = [MetaGraphsNext] Pages = ["weights.jl"] ``` -## LightGraphs.jl interface +## Graphs.jl interface ```@autodocs Modules = [MetaGraphsNext] -Pages = ["lightgraphs.jl"] +Pages = ["graphs.jl"] ``` ```@autodocs diff --git a/docs/src/index.md b/docs/src/index.md index 828344e..f809c2f 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,7 +4,7 @@ Welcome to `MetaGraphsNext.jl`, an experimental, type-stable replacement for [Me ## Getting started -To see how the package works, take a look at the tutorial. We first explain [the basics](tutorial_basics.md) of the `MetaGraph` structure, before moving on to its [integration](tutorial_lightgraphs.md) with `LightGraphs.jl`. +To see how the package works, take a look at the tutorial. We first explain [the basics](tutorial_basics.md) of the `MetaGraph` structure, before moving on to its [integration](tutorial_graphs.md) with `Graphs.jl`. ## Index diff --git a/docs/src/tutorial_basics.md b/docs/src/tutorial_basics.md index 317db53..a5e5b19 100644 --- a/docs/src/tutorial_basics.md +++ b/docs/src/tutorial_basics.md @@ -1,7 +1,7 @@ # Working with metagraphs ```jldoctest example -julia> using LightGraphs +julia> using Graphs julia> using MetaGraphsNext ``` @@ -120,7 +120,7 @@ julia> weighted[:red] = nothing; weighted[:blue] = nothing; weighted[:yellow] = julia> weighted[:red, :blue] = 1.0; weighted[:blue, :yellow] = 2.0; -julia> the_weights = LightGraphs.weights(weighted) +julia> the_weights = Graphs.weights(weighted) metaweights julia> size(the_weights) diff --git a/docs/src/tutorial_files.md b/docs/src/tutorial_files.md index ebe6417..da48167 100644 --- a/docs/src/tutorial_files.md +++ b/docs/src/tutorial_files.md @@ -1,7 +1,7 @@ # Read / write ```jldoctest readwrite -julia> using LightGraphs +julia> using Graphs julia> using MetaGraphsNext ``` diff --git a/docs/src/tutorial_lightgraphs.md b/docs/src/tutorial_graphs.md similarity index 77% rename from docs/src/tutorial_lightgraphs.md rename to docs/src/tutorial_graphs.md index 3950d5e..69604de 100644 --- a/docs/src/tutorial_lightgraphs.md +++ b/docs/src/tutorial_graphs.md @@ -1,16 +1,16 @@ -# LightGraphs.jl interface +# Graphs.jl interface -```jldoctest lightgraphs -julia> using LightGraphs +```jldoctest graphs +julia> using Graphs julia> using MetaGraphsNext ``` -`MetaGraph`s inherit many methods from LightGraphs.jl. In general, inherited methods refer to vertices by codes, not labels, for compatibility with AbstractGraph. Vertex codes get reassigned after `rem_vertex!` to remain contiguous, so we recommend using labels if possible. +`MetaGraph`s inherit many methods from Graphs.jl. In general, inherited methods refer to vertices by codes, not labels, for compatibility with AbstractGraph. Vertex codes get reassigned after `rem_vertex!` to remain contiguous, so we recommend using labels if possible. ## Undirected graphs -```jldoctest lightgraphs +```jldoctest graphs julia> colors = MetaGraph(Graph(), VertexMeta = String, EdgeMeta = Symbol, gprops = "special"); julia> colors[:red] = "warm"; @@ -56,10 +56,10 @@ false julia> has_vertex(colors, 1) true -julia> LightGraphs.SimpleGraphs.fadj(colors, 1) == Int[] +julia> Graphs.SimpleGraphs.fadj(colors, 1) == Int[] true -julia> LightGraphs.SimpleGraphs.badj(colors, 1) == Int[] +julia> Graphs.SimpleGraphs.badj(colors, 1) == Int[] true julia> colors == colors @@ -76,7 +76,7 @@ julia> SimpleGraph(colors) You can seemlessly make MetaGraphs based on DiGraphs as well. -```jldoctest lightgraphs +```jldoctest graphs julia> rock_paper_scissors = MetaGraph(DiGraph(), Label = Symbol, EdgeMeta = Symbol); julia> rock_paper_scissors[:rock] = nothing; rock_paper_scissors[:paper] = nothing; rock_paper_scissors[:scissors] = nothing; diff --git a/src/MetaGraphsNext.jl b/src/MetaGraphsNext.jl index 054124f..b9e091f 100644 --- a/src/MetaGraphsNext.jl +++ b/src/MetaGraphsNext.jl @@ -1,7 +1,7 @@ module MetaGraphsNext using JLD2 -using LightGraphs +using Graphs import Base: Tuple, @@ -18,7 +18,7 @@ import Base: size, zero -import LightGraphs: +import Graphs: AbstractGraph, AbstractGraphFormat, add_edge!, @@ -41,7 +41,7 @@ import LightGraphs: vertices, weights -import LightGraphs.SimpleGraphs: SimpleGraph, SimpleDiGraph, fadj, badj +import Graphs.SimpleGraphs: SimpleGraph, SimpleDiGraph, fadj, badj export MetaGraph, weighttype, defaultweight, weightfunction export MGFormat, DOTFormat @@ -51,7 +51,7 @@ export label_for, code_for include("metagraph.jl") include("metaundigraph.jl") include("metadigraph.jl") -include("lightgraphs.jl") +include("graphs.jl") include("weights.jl") include("dict_utils.jl") include("overrides.jl") diff --git a/src/dict_utils.jl b/src/dict_utils.jl index a9e05fa..b7c89ad 100644 --- a/src/dict_utils.jl +++ b/src/dict_utils.jl @@ -93,7 +93,7 @@ end """ code_for(meta::MetaGraph, vertex_label) -Find the code associated with a `vertex_label`. This can be useful to pass to methods inherited from `LightGraphs`. Note, however, that vertex codes could be +Find the code associated with a `vertex_label`. This can be useful to pass to methods inherited from `Graphs`. Note, however, that vertex codes could be reassigned after vertex deletion. """ function code_for(meta::MetaGraph, vertex_label) @@ -104,7 +104,7 @@ end """ label_for(meta::MetaGraph, vertex_code) -Find the label associated with a `vertex_code`. This can be useful to interpret the results of methods inherited from `LightGraphs`. Note, however, that vertex codes could be reassigned after vertex deletion. +Find the label associated with a `vertex_code`. This can be useful to interpret the results of methods inherited from `Graphs`. Note, however, that vertex codes could be reassigned after vertex deletion. """ function label_for(meta::MetaGraph, vertex_code) meta.metaindex[vertex_code] diff --git a/src/lightgraphs.jl b/src/graphs.jl similarity index 100% rename from src/lightgraphs.jl rename to src/graphs.jl