Skip to content

Commit

Permalink
Sbromberger/0.7 release (sbromberger#974)
Browse files Browse the repository at this point in the history
* first cut at 0.7 compat

* resolve global rng warnings

* ctranspose and next
  • Loading branch information
sbromberger authored Aug 8, 2018
1 parent 729c282 commit 81ab98d
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ os:
# - osx

julia:
# - 0.6
- 0.7
- nightly

notifications:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ julia> Pkg.add("LightGraphs")
* Julia 0.4: LightGraphs versions in the 0.6 series are designed to work with Julia 0.4.
* Julia 0.5: LightGraphs versions in the 0.7 series are designed to work with Julia 0.5.
* Julia 0.6: LightGraphs versions in the 0.8 through 0.12 series are designed to work with Julia 0.6.
* Julia 0.7: LightGraphs versions in the 0.14 series are designed to work with Julia 0.7.
* Julia 0.7: LightGraphs versions in the 1.0 series are designed to work with Julia 0.7.
* Later versions: Some functionality might not work with prerelease / unstable / nightly versions of Julia. If you run into a problem, please file an issue.

# Contributing and Reporting Bugs
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.7-
julia 0.7
CodecZlib 0.4
DataStructures 0.7
SimpleTraits 0.7.1
SimpleTraits 0.8
Arpack
2 changes: 1 addition & 1 deletion benchmark/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function bench_iteredges(g::AbstractGraph)
end

function bench_has_edge(g::AbstractGraph)
srand(1)
seed!(1)
nvg = nv(g)
srcs = rand([1:nvg;], cld(nvg, 4))
dsts = rand([1:nvg;], cld(nvg, 4))
Expand Down
7 changes: 3 additions & 4 deletions src/LightGraphs.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
__precompile__(true)
module LightGraphs

using SimpleTraits
Expand All @@ -13,15 +12,15 @@ using Distributed: @distributed
using LinearAlgebra: I, Symmetric, diagm, eigen, eigvals, norm, rmul!, tril, triu
import LinearAlgebra: Diagonal, issymmetric, mul!
# import Markdown
using Random: AbstractRNG, GLOBAL_RNG, MersenneTwister, randperm, randsubseq!, shuffle, shuffle!, srand
using Random: AbstractRNG, GLOBAL_RNG, MersenneTwister, randperm, randsubseq!, seed!, shuffle, shuffle!
using SharedArrays: SharedMatrix, SharedVector, sdata
using SparseArrays: SparseMatrixCSC, nonzeros, nzrange, rowvals
import SparseArrays: blockdiag, sparse

import Base: write, ==, <, *, , convert, isless, issubset, union, intersect,
import Base: adjoint, write, ==, <, *, , convert, isless, issubset, union, intersect,
reverse, reverse!, isassigned, getindex, setindex!, show,
print, copy, in, sum, size, eltype, length, ndims, transpose,
ctranspose, join, iterate, eltype, get, Pair, Tuple, zero
join, iterate, eltype, get, Pair, Tuple, zero

export
# Interface
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleGraphs/generators/euclideangraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ a matrix with the points' positions.
"""
function euclidean_graph(N::Int, d::Int;
L=1., seed = -1, kws...)
rng = LightGraphs.getRNG(seed)
points = rmul!(rand(rng, d, N), L)
_rng = LightGraphs.getRNG(seed)
points = rmul!(rand(_rng, d, N), L)
return (euclidean_graph(points; L=L, kws...)..., points)
end

Expand Down
4 changes: 2 additions & 2 deletions src/SimpleGraphs/generators/randgraphs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Random:
AbstractRNG, MersenneTwister, randperm, shuffle!, srand
AbstractRNG, MersenneTwister, randperm, seed!, shuffle!
using Statistics: mean

using LightGraphs:
Expand Down Expand Up @@ -305,7 +305,7 @@ function barabasi_albert!(g::AbstractGraph, n::Integer, k::Integer; seed::Int=-1
n0 == n && return g

# seed random number generator
seed > 0 && srand(seed)
seed > 0 && seed!(seed)

# add missing vertices
sizehint!(g.fadjlist, n)
Expand Down
2 changes: 1 addition & 1 deletion src/distance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ getindex(::DefaultDistance, s::Integer, d::Integer) = 1
getindex(::DefaultDistance, s::UnitRange, d::UnitRange) = DefaultDistance(length(s))
size(d::DefaultDistance) = (d.nv, d.nv)
transpose(d::DefaultDistance) = d
ctranspose(d::DefaultDistance) = d
adjoint(d::DefaultDistance) = d

"""
eccentricity(g[, v][, distmx])
Expand Down
4 changes: 1 addition & 3 deletions src/persistence/lg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ function loadlg_mult(io::IO)
graphs = Dict{String,AbstractGraph}()
while !eof(io)
line = strip(chomp(readline(io)))
if startswith(line, "#") || line == ""
next
else
if !(startswith(line, "#") || line == "")
header = _parse_header(line)
g = _lg_read_one_graph(io, header)
graphs[header.name] = g
Expand Down
2 changes: 1 addition & 1 deletion test/distance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@test size(d) == (3, 3)
@test d[1, 1] == getindex(d, 1, 1) == 1
@test d[1:2, 1:2] == LightGraphs.DefaultDistance(2)
@test d == transpose(d) == ctranspose(d)
@test d == transpose(d) == adjoint(d)
@test sprint(show, d) ==
stringmime("text/plain", d) ==
"$(d.nv) × $(d.nv) default distance matrix (value = 1)"
Expand Down
7 changes: 3 additions & 4 deletions test/experimental/isomorphism.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ cubic_graphs = [SimpleGraph(Edge.([(1,2), (1,3), (1,8), (2,3), (2,4), (3,4),
]
# vertex permutated versions of cubic_graphs
cubic_graphs_perm = []
global rng = MersenneTwister(1)
_rng = MersenneTwister(1)
for i = 1:length(cubic_graphs)
push!(cubic_graphs_perm, shuffle_vertices(cubic_graphs[i], randperm(rng, 8)))
push!(cubic_graphs_perm, shuffle_vertices(cubic_graphs[i], randperm(_rng, 8)))
end

@testset "Isomorphism" begin
Expand Down Expand Up @@ -71,8 +71,7 @@ end

# The frucht-graph is a 3-regular graph that has only one automorphism
g = smallgraph(:frucht)
rng = MersenneTwister(1)
perm = randperm(rng, 12)
perm = randperm(_rng, 12)
g2 = shuffle_vertices(g, perm)
perm_reconstructed = map(uv -> first(uv), first(all_isomorph(g2, g)))
@test perm == perm_reconstructed
Expand Down
2 changes: 1 addition & 1 deletion test/simplegraphs/generators/binomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function binomial_test(n, p, s)
@show-
@test abs(dσ - lσ) /< .10
end
srand(1234)
seed!(1234)
n = 10000
p = 0.3
s = 100000
Expand Down

0 comments on commit 81ab98d

Please sign in to comment.