diff --git a/Project.toml b/Project.toml index a29892e..2f11c9c 100644 --- a/Project.toml +++ b/Project.toml @@ -36,6 +36,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" [targets] -test = ["VisualRegressionTests", "LinearAlgebra", "Plots", "ImageMagick", "Random", "SparseArrays", "Test", "Markdown"] +test = ["VisualRegressionTests", "LinearAlgebra", "Plots", "ImageMagick", "Random", "SparseArrays", "Test", "Markdown", "StableRNGs"] diff --git a/assets/arc_chord_diagrams.png b/assets/arc_chord_diagrams.png index 09220ae..2cc7381 100644 Binary files a/assets/arc_chord_diagrams.png and b/assets/arc_chord_diagrams.png differ diff --git a/assets/ast_example.png b/assets/ast_example.png index 02c4352..bfddf6f 100644 Binary files a/assets/ast_example.png and b/assets/ast_example.png differ diff --git a/assets/custom_nodeshapes_single.png b/assets/custom_nodeshapes_single.png index 5b2e3f0..ec375be 100644 Binary files a/assets/custom_nodeshapes_single.png and b/assets/custom_nodeshapes_single.png differ diff --git a/assets/custom_nodeshapes_various.png b/assets/custom_nodeshapes_various.png index 0ed329c..b6f1a25 100644 Binary files a/assets/custom_nodeshapes_various.png and b/assets/custom_nodeshapes_various.png differ diff --git a/assets/directed.png b/assets/directed.png index 2a6affc..fa5e57c 100644 Binary files a/assets/directed.png and b/assets/directed.png differ diff --git a/assets/edgelabel.png b/assets/edgelabel.png index 7e3dfba..31c3d97 100644 Binary files a/assets/edgelabel.png and b/assets/edgelabel.png differ diff --git a/assets/funky_edge_and_marker_args.png b/assets/funky_edge_and_marker_args.png index 344cabb..52ab784 100644 Binary files a/assets/funky_edge_and_marker_args.png and b/assets/funky_edge_and_marker_args.png differ diff --git a/assets/julia_dict_tree.png b/assets/julia_dict_tree.png index 65007c2..ee3e14e 100644 Binary files a/assets/julia_dict_tree.png and b/assets/julia_dict_tree.png differ diff --git a/assets/julia_type_tree.png b/assets/julia_type_tree.png index 66d7364..05ea3a9 100644 Binary files a/assets/julia_type_tree.png and b/assets/julia_type_tree.png differ diff --git a/assets/light_graphs.png b/assets/light_graphs.png index 4e80296..e9e7d8f 100644 Binary files a/assets/light_graphs.png and b/assets/light_graphs.png differ diff --git a/assets/marker_properties.png b/assets/marker_properties.png index dc93fb9..04fdc1c 100644 Binary files a/assets/marker_properties.png and b/assets/marker_properties.png differ diff --git a/assets/multigraphs.png b/assets/multigraphs.png index ccb979b..4337789 100644 Binary files a/assets/multigraphs.png and b/assets/multigraphs.png differ diff --git a/assets/random_3d_graph.png b/assets/random_3d_graph.png index aa46ee0..ad624d8 100644 Binary files a/assets/random_3d_graph.png and b/assets/random_3d_graph.png differ diff --git a/assets/random_labelled_graph.png b/assets/random_labelled_graph.png index 2567099..65ab4d2 100644 Binary files a/assets/random_labelled_graph.png and b/assets/random_labelled_graph.png differ diff --git a/assets/readme_julia_logo_pun.png b/assets/readme_julia_logo_pun.png index 30eb12c..805b59e 100644 Binary files a/assets/readme_julia_logo_pun.png and b/assets/readme_julia_logo_pun.png differ diff --git a/assets/selfedges.png b/assets/selfedges.png index e27be80..32f4c36 100644 Binary files a/assets/selfedges.png and b/assets/selfedges.png differ diff --git a/test/figures.jl b/test/figures.jl index 850085d..099bf91 100644 --- a/test/figures.jl +++ b/test/figures.jl @@ -1,4 +1,4 @@ -using Random +using StableRNGs using VisualRegressionTests using LinearAlgebra using SparseArrays diff --git a/test/functions.jl b/test/functions.jl index dc9ab60..a785afb 100644 --- a/test/functions.jl +++ b/test/functions.jl @@ -1,14 +1,14 @@ function random_labelled_graph() n = 15 - Random.seed!(1) - A = Float64[ rand() < 0.5 ? 0 : rand() for i=1:n, j=1:n] + rng = StableRNG(1) + A = Float64[ rand(rng) < 0.5 ? 0 : rand(rng) for i=1:n, j=1:n] for i=1:n A[i, 1:i-1] = A[1:i-1, i] A[i, i] = 0 end - x = rand(n) - y = rand(n) - z = rand(n) + x = rand(rng,n) + y = rand(rng,n) + z = rand(rng,n) p = graphplot(A, nodesize = 0.2, node_weights = 1:n, @@ -74,7 +74,8 @@ function multigraphs() end function arc_chord_diagrams() - adjmat = Symmetric(sparse(rand(0:1,8,8))) + rng = StableRNG(2) + adjmat = Symmetric(sparse(rand(rng,0:1,8,8))) plot( graphplot(adjmat, method=:chorddiagram, @@ -93,15 +94,16 @@ end function marker_properties() N = 8 - g = barabasi_albert(N, 1; seed = 42) + seed = 42 + g = barabasi_albert(N, 1; seed=seed) weights = [length(neighbors(g, i)) for i in 1:nv(g)] - Random.seed!(42) + rng = StableRNG(seed) graphplot(g, curvature_scalar=0, node_weights=weights, nodesize=0.25, linecolor=:gray, linewidth=2.5, nodeshape=:circle, - node_z=rand(N), markercolor=:viridis, + node_z=rand(rng,N), markercolor=:viridis, nodestrokewidth=1.5, markerstrokestyle=:solid, markerstrokealpha=1.0, @@ -157,8 +159,8 @@ function diamond_nodeshape_wh(x_i, y_i, h, w) end function custom_nodeshapes_single() - Random.seed!(6) - g = rand(5,5) + rng = StableRNG(6) + g = rand(rng,5,5) g[g .> 0.5] .= 0 for i in 1:5 g[i,i] = 0 @@ -167,8 +169,8 @@ function custom_nodeshapes_single() end function custom_nodeshapes_various() - Random.seed!(6) - g = rand(5,5) + rng = StableRNG(6) + g = rand(rng,5,5) g[g .> 0.5] .= 0 for i in 1:5 g[i,i] = 0 @@ -177,7 +179,6 @@ function custom_nodeshapes_various() end function funky_edge_and_marker_args() - Random.seed!(6) n = 5 g = SimpleDiGraph(n) diff --git a/test/generate_figures.jl b/test/generate_figures.jl index 7c320a8..d1ebb11 100644 --- a/test/generate_figures.jl +++ b/test/generate_figures.jl @@ -1,4 +1,4 @@ -using Random +using StableRNGs using LinearAlgebra using SparseArrays using GraphRecipes