Skip to content

Commit 130b7e5

Browse files
authored
Merge pull request #58 from devmotion/dw/deps
Update dependencies, Julia compat, and add weak dependencies
2 parents f16fa63 + 8fc54cf commit 130b7e5

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

Project.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
name = "NetworkLayout"
22
uuid = "46757867-2c16-5918-afeb-47bfcb05e46a"
3-
version = "0.4.6"
3+
version = "0.4.7"
44

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

1312
[compat]
1413
GeometryBasics = "0.4"
14+
Graphs = "1"
1515
Requires = "1"
1616
StaticArrays = "1"
17-
julia = "1"
17+
julia = "1.6"
18+
19+
[extensions]
20+
NetworkLayoutGraphsExt = "Graphs"
1821

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

2630
[targets]
27-
test = ["Graphs", "Test", "DelimitedFiles", "GeometryTypes"]
31+
test = ["Graphs", "Test", "DelimitedFiles", "GeometryTypes", "SparseArrays"]
32+
33+
[weakdeps]
34+
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

ext/NetworkLayoutGraphsExt.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module NetworkLayoutGraphsExt
2+
3+
if isdefined(Base, :get_extension)
4+
import NetworkLayout
5+
import Graphs
6+
else
7+
import ..NetworkLayout
8+
import ..Graphs
9+
end
10+
11+
function NetworkLayout.layout(l::NetworkLayout.AbstractLayout, g::Graphs.AbstractGraph)
12+
NetworkLayout.layout(l, Graphs.adjacency_matrix(g))
13+
end
14+
function NetworkLayout.LayoutIterator(l::NetworkLayout.IterativeLayout, g::Graphs.AbstractGraph)
15+
NetworkLayout.LayoutIterator(l, Graphs.adjacency_matrix(g))
16+
end
17+
18+
end # module

src/NetworkLayout.jl

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module NetworkLayout
22

33
using GeometryBasics
4-
using Requires
54
using LinearAlgebra: norm
65
using Random
76
using StaticArrays
@@ -86,21 +85,13 @@ function layout(alg::IterativeLayout, adj_matrix::AbstractMatrix)
8685
return pos
8786
end
8887

89-
function __init__()
90-
@require LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" begin
91-
function layout(l::AbstractLayout, g::LightGraphs.AbstractGraph)
92-
layout(l, LightGraphs.adjacency_matrix(g))
93-
end
94-
function LayoutIterator(l::IterativeLayout, g::LightGraphs.AbstractGraph)
95-
LayoutIterator(l, LightGraphs.adjacency_matrix(g))
96-
end
97-
end
98-
@require Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" begin
99-
function layout(l::AbstractLayout, g::Graphs.AbstractGraph)
100-
layout(l, Graphs.adjacency_matrix(g))
101-
end
102-
function LayoutIterator(l::IterativeLayout, g::Graphs.AbstractGraph)
103-
LayoutIterator(l, Graphs.adjacency_matrix(g))
88+
if !isdefined(Base, :get_extension)
89+
using Requires
90+
end
91+
@static if !isdefined(Base, :get_extension)
92+
function __init__()
93+
@require Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" begin
94+
include("../ext/NetworkLayoutGraphsExt.jl")
10495
end
10596
end
10697
end

src/stress.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using LinearAlgebra: checksquare, norm, pinv, mul!
2-
using SparseArrays: SparseMatrixCSC
32

43
export Stress, stress
54

0 commit comments

Comments
 (0)