Skip to content

Commit

Permalink
switch to Graphs.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
bramtayl committed Oct 29, 2021
1 parent 1e48015 commit 307fe68
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 50 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -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 }}
14 changes: 14 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 0 additions & 15 deletions .github/workflows/daily.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/permanent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
version:
- '1.0'
- '1.4'
- '1'
- 'nightly'
steps:
- uses: actions/checkout@v2
Expand All @@ -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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorial_basics.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Working with metagraphs

```jldoctest example
julia> using LightGraphs
julia> using Graphs
julia> using MetaGraphsNext
```
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorial_files.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Read / write

```jldoctest readwrite
julia> using LightGraphs
julia> using Graphs
julia> using MetaGraphsNext
```
Expand Down
16 changes: 8 additions & 8 deletions docs/src/tutorial_lightgraphs.md → docs/src/tutorial_graphs.md
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/MetaGraphsNext.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module MetaGraphsNext

using JLD2
using LightGraphs
using Graphs

import Base:
Tuple,
Expand All @@ -18,7 +18,7 @@ import Base:
size,
zero

import LightGraphs:
import Graphs:
AbstractGraph,
AbstractGraphFormat,
add_edge!,
Expand All @@ -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
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/dict_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]
Expand Down
File renamed without changes.

2 comments on commit 307fe68

@bramtayl
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/47751

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 307fe682eff25a5a0221438f950a340cf0defa05
git push origin v0.2.0

Please sign in to comment.