Skip to content

Commit

Permalink
Merge pull request #58 from devmotion/dw/deps
Browse files Browse the repository at this point in the history
Update dependencies, Julia compat, and add weak dependencies
  • Loading branch information
hexaeder committed Oct 6, 2023
2 parents f16fa63 + 8fc54cf commit 130b7e5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
15 changes: 11 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
name = "NetworkLayout"
uuid = "46757867-2c16-5918-afeb-47bfcb05e46a"
version = "0.4.6"
version = "0.4.7"

[deps]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
GeometryBasics = "0.4"
Graphs = "1"
Requires = "1"
StaticArrays = "1"
julia = "1"
julia = "1.6"

[extensions]
NetworkLayoutGraphsExt = "Graphs"

[extras]
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Graphs", "Test", "DelimitedFiles", "GeometryTypes"]
test = ["Graphs", "Test", "DelimitedFiles", "GeometryTypes", "SparseArrays"]

[weakdeps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
18 changes: 18 additions & 0 deletions ext/NetworkLayoutGraphsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module NetworkLayoutGraphsExt

if isdefined(Base, :get_extension)
import NetworkLayout
import Graphs
else
import ..NetworkLayout
import ..Graphs
end

function NetworkLayout.layout(l::NetworkLayout.AbstractLayout, g::Graphs.AbstractGraph)
NetworkLayout.layout(l, Graphs.adjacency_matrix(g))
end
function NetworkLayout.LayoutIterator(l::NetworkLayout.IterativeLayout, g::Graphs.AbstractGraph)
NetworkLayout.LayoutIterator(l, Graphs.adjacency_matrix(g))
end

end # module
23 changes: 7 additions & 16 deletions src/NetworkLayout.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module NetworkLayout

using GeometryBasics
using Requires
using LinearAlgebra: norm
using Random
using StaticArrays
Expand Down Expand Up @@ -86,21 +85,13 @@ function layout(alg::IterativeLayout, adj_matrix::AbstractMatrix)
return pos
end

function __init__()
@require LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" begin
function layout(l::AbstractLayout, g::LightGraphs.AbstractGraph)
layout(l, LightGraphs.adjacency_matrix(g))
end
function LayoutIterator(l::IterativeLayout, g::LightGraphs.AbstractGraph)
LayoutIterator(l, LightGraphs.adjacency_matrix(g))
end
end
@require Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" begin
function layout(l::AbstractLayout, g::Graphs.AbstractGraph)
layout(l, Graphs.adjacency_matrix(g))
end
function LayoutIterator(l::IterativeLayout, g::Graphs.AbstractGraph)
LayoutIterator(l, Graphs.adjacency_matrix(g))
if !isdefined(Base, :get_extension)
using Requires
end
@static if !isdefined(Base, :get_extension)
function __init__()
@require Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" begin
include("../ext/NetworkLayoutGraphsExt.jl")
end
end
end
Expand Down
1 change: 0 additions & 1 deletion src/stress.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LinearAlgebra: checksquare, norm, pinv, mul!
using SparseArrays: SparseMatrixCSC

export Stress, stress

Expand Down

0 comments on commit 130b7e5

Please sign in to comment.