Skip to content

Commit

Permalink
switch LightGraphs to Graphs (#11)
Browse files Browse the repository at this point in the history
* switch LightGraphs to Graphs

* bump version

* change ci to latest stable version

* Update Project.toml

Co-authored-by: Rogerluo <rogerluo.rl18@gmail.com>
  • Loading branch information
GiggleLiu and Roger-luo authored Dec 2, 2021
1 parent 8d1c075 commit 5d0866b
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.5'
- '1'
- 'nightly'
os:
- ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "Multigraphs"
uuid = "7ebac608-6c66-46e6-9856-b5f43e107bac"
authors = ["Chen Zhao"]
version = "0.2.2"
version = "0.3.0"

[deps]
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
LightGraphs = "1"
Graphs = "1.4"
julia = "1.2"

[extras]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![CI](https://github.com/QuantumBFS/Multigraphs.jl/workflows/CI/badge.svg)](https://github.com/QuantumBFS/Multigraphs.jl/actions)
[![Codecov](https://codecov.io/gh/QuantumBFS/Multigraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/QuantumBFS/Multigraphs.jl)

Multigraphs extension for `LightGraphs.jl`.
Multigraphs extension for `Graphs.jl`.

## Installation

Expand All @@ -25,7 +25,7 @@ pkg> add Multigraphs
## Examples

```julia
using LightGraphs, Multigraphs
using Graphs, Multigraphs

# create a undirected multigraph with 3 vertices and 0 multiple edges
# use DiMultigraph for directed multigraphs
Expand Down Expand Up @@ -53,7 +53,7 @@ julia> mes = [me for me in edges(mg)]
Multiple edge 1 => 2 with multiplicity 2
Multiple edge 2 => 3 with multiplicity 1

# here e is a LightGraphs.SimpleEdge
# here e is a Graphs.SimpleEdge
julia> for e in mes[1]
println(e)
end
Expand Down
2 changes: 1 addition & 1 deletion src/Multigraphs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Multigraphs
An multigraph extension for `LightGraphs`.
An multigraph extension for `Graphs`.
"""
module Multigraphs

Expand Down
12 changes: 6 additions & 6 deletions src/abstract_multigraph.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using LightGraphs
using Graphs
using SparseArrays

import Base: show, eltype, copy
import LightGraphs: nv, has_edge, has_vertex, add_edge!, rem_edge!, rem_vertex!,
import Graphs: nv, has_edge, has_vertex, add_edge!, rem_edge!, rem_vertex!,
rem_vertices!, add_vertex!, add_vertices!, outneighbors, inneighbors, vertices, edges,
adjacency_matrix, src, dst, nv, edgetype

Expand Down Expand Up @@ -57,7 +57,7 @@ is not less than `mul`.
## Examples
```julia
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> mg = Multigraph(3);
Expand All @@ -82,7 +82,7 @@ Return `true` multiple edge was added successfully, otherwise return `false`.
## Examples
```julia
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> mg = Multigraph(3);
Expand All @@ -109,7 +109,7 @@ a multiple edge.
## Examples
```julia
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> mg = Multigraph(3);
Expand Down Expand Up @@ -139,7 +139,7 @@ Return a `MultipleEdgeIter` for `mg`.
## Examples
```jltestdoc
julia>
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> mg = Multigraph(path_graph(4));
Expand Down
6 changes: 3 additions & 3 deletions src/di_multigraph_adjlist.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using LightGraphs, SparseArrays, LinearAlgebra
using Graphs, SparseArrays, LinearAlgebra

import Base: copy
import LightGraphs: nv, has_edge, add_edge!, rem_edge!, rem_vertex!,
import Graphs: nv, has_edge, add_edge!, rem_edge!, rem_vertex!,
rem_vertices!, add_vertex!, add_vertices!, outneighbors, inneighbors, neighbors,
vertices, adjacency_matrix, ne, is_directed, degree, indegree, outdegree, edges,
has_vertex, all_neighbors
Expand Down Expand Up @@ -53,7 +53,7 @@ function DiMultigraph(n::T) where {T<:Integer}
end
return DiMultigraph(adjlist)
end
DiMultigraph(g::SimpleDiGraph{T}) where {T<:Integer} = DiMultigraph(Dict(zip(T(1):nv(g), LightGraphs.SimpleGraphs.fadj(g))))
DiMultigraph(g::SimpleDiGraph{T}) where {T<:Integer} = DiMultigraph(Dict(zip(T(1):nv(g), Graphs.SimpleGraphs.fadj(g))))

copy(mg::DiMultigraph{T}) where {T} = DiMultigraph{T}(deepcopy(mg.adjlist), mg._idmax)

Expand Down
6 changes: 3 additions & 3 deletions src/multigraph_adjlist.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using LightGraphs, SparseArrays, LinearAlgebra
using Graphs, SparseArrays, LinearAlgebra

import Base: copy
import LightGraphs: nv, has_edge, add_edge!, rem_edge!, rem_vertex!,
import Graphs: nv, has_edge, add_edge!, rem_edge!, rem_vertex!,
rem_vertices!, add_vertex!, add_vertices!, outneighbors, inneighbors, neighbors,
vertices, adjacency_matrix, ne, is_directed, degree, indegree, outdegree, edges,
has_vertex, all_neighbors
Expand Down Expand Up @@ -56,7 +56,7 @@ function Multigraph(n::T) where {T<:Integer}
end
return Multigraph(adjlist)
end
Multigraph(g::SimpleGraph{T}) where {T<:Integer} = Multigraph(Dict(zip(T(1):nv(g), LightGraphs.SimpleGraphs.fadj(g))))
Multigraph(g::SimpleGraph{T}) where {T<:Integer} = Multigraph(Dict(zip(T(1):nv(g), Graphs.SimpleGraphs.fadj(g))))

copy(mg::Multigraph{T}) where {T} = Multigraph{T}(deepcopy(mg.adjlist), mg._idmax)

Expand Down
6 changes: 3 additions & 3 deletions src/multiple_edge.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Base: eltype, Pair, Tuple, show, ==, iterate, length
import LightGraphs: AbstractEdge, SimpleEdge, src, dst, reverse
import Graphs: AbstractEdge, SimpleEdge, src, dst, reverse

export AbstractMultipleEdge, MultipleEdge, mul

Expand All @@ -17,7 +17,7 @@ A struct representing multiple edges.
## Examples
```jltestdoc
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> me = MultipleEdge(1, 2, 3)
Multiple edge 1 => 2 with multiplicity 3
Expand Down Expand Up @@ -67,7 +67,7 @@ Return the multiplicity of the multiple edge `e`.
## Examples
```jltestdoc
julia> using LightGraphs, Multigraphs
julia> using Graphs, Multigraphs
julia> me = MultipleEdge(1, 2, 3)
Multiple edge 1 => 2 with multiplicity 3
Expand Down
2 changes: 1 addition & 1 deletion src/multiple_edge_iter.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LightGraphs
using Graphs

import Base: eltype, iterate, length

Expand Down
2 changes: 1 addition & 1 deletion test/di_multigraph_adjlist.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Multigraphs, LightGraphs, SparseArrays
using Multigraphs, Graphs, SparseArrays
using Test
try
m2 = spzeros(Int, 2, 3)
Expand Down
2 changes: 1 addition & 1 deletion test/multigraph_adjlist.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Multigraphs, LightGraphs, SparseArrays
using Multigraphs, Graphs, SparseArrays
try
m2 = spzeros(Int, 2, 3)
dg = Multigraph(m2)
Expand Down
2 changes: 1 addition & 1 deletion test/multiple_edge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ catch err
@test err != nothing
end
@test src(me) == 1 && dst(me) == 2 && mul(me) == 3
e0 = LightGraphs.SimpleEdge(me)
e0 = Graphs.SimpleEdge(me)
MultipleEdge(e0)
@test MultipleEdge(1, 2) == e0
@test e0 == MultipleEdge(1, 2)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Multigraphs, LightGraphs, SparseArrays
using Multigraphs, Graphs, SparseArrays
using Test

@testset "multiple_edge.jl" begin
Expand Down

2 comments on commit 5d0866b

@Roger-luo
Copy link
Member

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/49734

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.3.0 -m "<description of version>" 5d0866bed57a94d86402f42c7572021a5562ddc9
git push origin v0.3.0

Please sign in to comment.