File tree Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change 25
25
#=
26
26
Coloring needs to satisfy two conditions:
27
27
28
- 1. every pair of adjacent vertices receives distinct colors
28
+ 1. every pair of adjacent vertices receives distinct colors
29
29
(a distance-1 coloring)
30
30
31
31
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
34
34
colors.
35
35
=#
36
36
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
38
60
g = test_graphs[i]
39
61
40
62
out_colors1 = SparseDiffTools. color_graph (g,SparseDiffTools. GreedyStar1Color ())
@@ -50,7 +72,7 @@ for i in 1:5
50
72
51
73
# test condition 2
52
74
for j = vertices (g)
53
- walk = saw (g, j, 4 )
75
+ walk = LightGraphs . saw (g, j, 4 )
54
76
walk_colors = zeros (Int64, 0 )
55
77
if length (walk) >= 4
56
78
for t in walk
@@ -70,7 +92,7 @@ for i in 1:5
70
92
71
93
# test condition 2
72
94
for j = vertices (g)
73
- walk = saw (g, j, 4 )
95
+ walk = LighGraphs . saw (g, j, 4 )
74
96
walk_colors = zeros (Int64, 0 )
75
97
if length (walk) >= 4
76
98
for t in walk
You can’t perform that action at this time.
0 commit comments