Skip to content

Commit 701e195

Browse files
committed
added graph from paper in tests
1 parent 9a2d26f commit 701e195

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

test/test_greedy_star.jl

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ end
2525
#=
2626
Coloring needs to satisfy two conditions:
2727
28-
1. every pair of adjacent vertices receives distinct colors
28+
1. every pair of adjacent vertices receives distinct colors
2929
(a distance-1 coloring)
3030
3131
2. For any vertex v, any color that leads to a two-colored path
@@ -34,7 +34,29 @@ In other words, every path on four vertices uses at least three
3434
colors.
3535
=#
3636

37-
for i in 1:5
37+
38+
#Sample graph from Gebremedhin AH, Manne F, Pothen A. **What color is your Jacobian? Graph coloring for computing derivatives.**
39+
40+
#=
41+
(2)
42+
/ \
43+
/ \
44+
(1)----(3)----(4)
45+
46+
=#
47+
48+
inner = SimpleGraph(4)
49+
g = VSafeGraph(inner)
50+
51+
add_edge!(g,1,2)
52+
add_edge!(g,1,3)
53+
add_edge!(g,2,3)
54+
add_edge!(g,3,4)
55+
56+
push!(test_graphs, g)
57+
58+
#begin testing
59+
for i in 1:6
3860
g = test_graphs[i]
3961

4062
out_colors1 = SparseDiffTools.color_graph(g,SparseDiffTools.GreedyStar1Color())
@@ -50,7 +72,7 @@ for i in 1:5
5072

5173
#test condition 2
5274
for j = vertices(g)
53-
walk = saw(g, j, 4)
75+
walk = LightGraphs.saw(g, j, 4)
5476
walk_colors = zeros(Int64, 0)
5577
if length(walk) >= 4
5678
for t in walk
@@ -70,7 +92,7 @@ for i in 1:5
7092

7193
#test condition 2
7294
for j = vertices(g)
73-
walk = saw(g, j, 4)
95+
walk = LighGraphs.saw(g, j, 4)
7496
walk_colors = zeros(Int64, 0)
7597
if length(walk) >= 4
7698
for t in walk

0 commit comments

Comments
 (0)