1
- using FactCheck
2
1
using GraphPlot
3
2
using LightGraphs
4
3
using Colors
5
4
using Compose
5
+ using Base. Test
6
6
7
7
g = graphfamous (" karate" )
8
8
h = LightGraphs. WheelGraph (10 )
@@ -11,29 +11,28 @@ nodelabel = collect(1:nv(g))
11
11
nodesize = outdegree (g) .* 1.0
12
12
13
13
cachedout = joinpath (Pkg. dir (" GraphPlot" ), " test" , " examples" )
14
- facts (" karate network (undirected), nodesize is proportion to its degree" ) do
14
+
15
+ @testset " Undirected Karate Net" begin
15
16
filename = joinpath (cachedout, " karate_different_nodesize.svg" )
16
17
draw (SVG (filename, 8 inch, 8 inch), gplot (g, nodesize= nodesize.^ 0.3 , nodelabel= nodelabel, nodelabelsize= nodesize.^ 0.3 ))
17
18
end
18
19
19
- facts (" karate network as directed" ) do
20
- FactCheck. context (" straight line edge" ) do
21
- filename = joinpath (cachedout, " karate_straight_directed.svg" )
22
- draw (SVG (filename, 10 inch, 10 inch), gplot (g, arrowlengthfrac= 0.02 , nodelabel= nodelabel))
23
- end
20
+ @testset " Directed Karate Net" begin
21
+ filename = joinpath (cachedout, " karate_straight_directed.svg" )
22
+ draw (SVG (filename, 10 inch, 10 inch), gplot (g, arrowlengthfrac= 0.02 , nodelabel= nodelabel))
24
23
end
25
24
26
- facts ( " Nodes in different memberships have different colors (karate network) " ) do
25
+ @testset " Membership " begin
27
26
# nodes membership
28
- membership = [1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,2 ,1 ,1 ,1 ,1 ,1 ,2 ,2 ,1 ,1 ,2 ,1 ,2 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ]
29
- nodecolor = [colorant " lightseagreen" , colorant " orange" ]
30
- # membership color
31
- nodefillc = nodecolor[membership]
27
+ membership = [1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,2 ,1 ,1 ,1 ,1 ,1 ,2 ,2 ,1 ,1 ,2 ,1 ,2 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ]
28
+ nodecolor = [colorant " lightseagreen" , colorant " orange" ]
29
+ # membership color
30
+ nodefillc = nodecolor[membership]
32
31
filename = joinpath (cachedout, " karate_groups.svg" )
33
32
draw (SVG (filename, 8 inch, 8 inch), gplot (g, nodelabel= nodelabel, nodefillc= nodefillc))
34
33
end
35
34
36
- facts ( " LightGraphs test " ) do
35
+ @testset " WheelGraph " begin
37
36
filename = joinpath (cachedout, " LightGraphs_wheel10.svg" )
38
37
draw (SVG (filename, 8 inch, 8 inch), gplot (h))
39
38
end
0 commit comments