Skip to content

Commit

Permalink
Merge pull request #1 from JuliaGraphs/transition-to-graphs.jl
Browse files Browse the repository at this point in the history
Migrate from LightGraphs to Graphs.jl
  • Loading branch information
simonschoelly authored Oct 17, 2021
2 parents c14d2e8 + 4e64abe commit 97a42ed
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "MetaGraphs"
uuid = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
version = "0.6.8"
version = "0.7.0"

[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[compat]
Graphs = "1.4"
JLD2 = "0.1.11, 0.2, 0.3, 0.4"
LightGraphs = "1.3.5"
julia = "1"

[extras]
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
[![Codecov branch][codecov-img]][codecov-url]
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://juliagraphs.github.io/MetaGraphs.jl/latest)

**Project Status:** As of 8 October 2021 MetaGraphs is no longer under active development. It will remain available on Github at [sbromberger/MetaGraphs.jl](/~https://github.com/sbromberger/MetaGraphs.jl). The JuliaGraphs organization will continue to maintain packages that use MetaGraphs and transition development over the long term.

[LightGraphs.jl](/~https://github.com/JuliaGraphs/LightGraphs.jl) graphs with arbitrary metadata.
[MetaGraphs.jl](/~https://github.com/JuliaGraphs/MetaGraphs.jl) graphs with arbitrary metadata.

[build-img]: /~https://github.com/JuliaGraphs/Metagraphs.jl/workflows/CI/badge.svg?branch=master
[build-url]: /~https://github.com/JuliaGraphs/Metagraphs.jl/actions?query=workflow%3ACI
Expand All @@ -25,7 +23,7 @@ add MetaGraphs

## Example Usage
```julia
julia> using LightGraphs, MetaGraphs
julia> using Graphs, MetaGraphs

# create a standard simplegraph
julia> g = path_graph(5)
Expand Down Expand Up @@ -87,7 +85,7 @@ Dict{Symbol,Any} with 0 entries
julia> props(mg, 2)
Dict{Symbol,Any} with 0 entries

# all LightGraphs analytics work
# all Graphs.jl analytics work
julia> betweenness_centrality(mg)
5-element Array{Float64,1}:
0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/oldmkdocsyml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site_name: MetaGraphs.jl
repo_url: /~https://github.com/JuliaGraphs/MetaGraphs.jl
site_description: Metadata for LightGraphs
site_description: Metadata for Graphs.jl
site_author: Seth Bromberger

theme: readthedocs
Expand Down
8 changes: 4 additions & 4 deletions src/MetaGraphs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module MetaGraphs
using LightGraphs
using Graphs
using JLD2

import Base:
Expand All @@ -9,7 +9,7 @@ import Base:
import Random:
randstring, seed!

import LightGraphs:
import Graphs:
AbstractGraph, src, dst, edgetype, nv,
ne, vertices, edges, is_directed,
add_vertex!, add_edge!, rem_vertex!, rem_edge!,
Expand All @@ -19,7 +19,7 @@ import LightGraphs:
loadgraph, savegraph, AbstractGraphFormat,
reverse

import LightGraphs.SimpleGraphs:
import Graphs.SimpleGraphs:
AbstractSimpleGraph, SimpleGraph, SimpleDiGraph,
SimpleEdge, fadj, badj

Expand Down Expand Up @@ -194,7 +194,7 @@ MetaWeights(g::AbstractMetaGraph) = MetaWeights{eltype(g),eltype(g.defaultweight

function getindex(w::MetaWeights{T,U}, u::Integer, v::Integer)::U where T <: Integer where U <: Real
_e = Edge(u, v)
e = !w.directed && !LightGraphs.is_ordered(_e) ? reverse(_e) : _e
e = !w.directed && !Graphs.is_ordered(_e) ? reverse(_e) : _e
!haskey(w.eprops, e) && return w.defaultweight
return U(get(w.eprops[e], w.weightfield, w.defaultweight))
end
Expand Down
4 changes: 2 additions & 2 deletions src/metagraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ is_directed(g::MetaGraph) = false

weighttype(g::MetaGraph{T,U}) where T where U = U
function props(g::MetaGraph, _e::SimpleEdge)
e = LightGraphs.is_ordered(_e) ? _e : reverse(_e)
e = Graphs.is_ordered(_e) ? _e : reverse(_e)
get(PropDict, g.eprops, e)
end

function set_props!(g::MetaGraph, _e::SimpleEdge, d::Dict)
e = LightGraphs.is_ordered(_e) ? _e : reverse(_e)
e = Graphs.is_ordered(_e) ? _e : reverse(_e)
if has_edge(g, e)
if !_hasdict(g, e)
g.eprops[e] = d
Expand Down
2 changes: 1 addition & 1 deletion test/dotformat.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using MetaGraphs
using Test
using LightGraphs
using Graphs

property_set=[
(src="thirty",dst="inf",color="missing",penwidth="missing",style="missing",),
Expand Down
10 changes: 5 additions & 5 deletions test/metagraphs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using MetaGraphs
import LightGraphs: SimpleGraphs
import Graphs: SimpleGraphs
import Base64:
stringmime

Expand Down Expand Up @@ -32,8 +32,8 @@ import Base64:
@test eltype(@inferred(MetaGraph{UInt8,Float16}(mg))) == UInt8
@test weighttype(@inferred(MetaGraph{UInt8,Float16}(mg))) == Float16

@test @inferred(MetaGraphs.fadj(mg, 2)) == LightGraphs.SimpleGraphs.fadj(g, 2)
@test @inferred(MetaGraphs.badj(mg, 2)) == LightGraphs.SimpleGraphs.badj(g, 2)
@test @inferred(MetaGraphs.fadj(mg, 2)) == Graphs.SimpleGraphs.fadj(g, 2)
@test @inferred(MetaGraphs.badj(mg, 2)) == Graphs.SimpleGraphs.badj(g, 2)

@test @inferred(edgetype(mg)) == edgetype(mg.graph)

Expand Down Expand Up @@ -88,8 +88,8 @@ import Base64:
@test eltype(@inferred(MetaDiGraph{UInt8,Float16}(mg))) == UInt8
@test weighttype(@inferred(MetaDiGraph{UInt8,Float16}(mg))) == Float16

@test @inferred(MetaGraphs.fadj(mg, 2)) == LightGraphs.SimpleGraphs.fadj(g, 2)
@test @inferred(MetaGraphs.badj(mg, 2)) == LightGraphs.SimpleGraphs.badj(g, 2)
@test @inferred(MetaGraphs.fadj(mg, 2)) == Graphs.SimpleGraphs.fadj(g, 2)
@test @inferred(MetaGraphs.badj(mg, 2)) == Graphs.SimpleGraphs.badj(g, 2)

@test @inferred(edgetype(mg)) == edgetype(mg.graph)

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using LightGraphs
using Graphs
using MetaGraphs
using Test

import LightGraphs.SimpleGraphs: SimpleGraph, SimpleDiGraph
import Graphs.SimpleGraphs: SimpleGraph, SimpleDiGraph

const testdir = @__DIR__

Expand Down

2 comments on commit 97a42ed

@simonschoelly
Copy link
Member 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/46933

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.7.0 -m "<description of version>" 97a42ed985aa7418ab473f0b320dd068bfca616f
git push origin v0.7.0

Please sign in to comment.