5
5
"""
6
6
function color_graph (G:: VSafeGraph ,:: BSCColor )
7
7
V = nv (G)
8
- F = zeros (Int64 , V)
9
- freeColors = [Vector {Int64 } () for _ in 1 : V] # set of free colors for each vertex
10
- U = zeros (Int64 , 0 ) # stores set of free colors
11
- # F = zeros(Int64 , 0) #stores final coloring of vertices
8
+ F = zeros (Int , V)
9
+ freeColors = [Vector {Int } () for _ in 1 : V] # set of free colors for each vertex
10
+ U = zeros (Int , 0 ) # stores set of free colors
11
+ # F = zeros(Int , 0) #stores final coloring of vertices
12
12
13
13
sorted_vertices = order_by_degree (G)
14
14
start = 1
71
71
72
72
Find the degree of the vertex z which belongs to the graph G.
73
73
"""
74
- function degree (G:: VSafeGraph ,z:: Int64 )
74
+ function degree (G:: VSafeGraph ,z:: Int )
75
75
return length (inneighbors (G,z))
76
76
end
77
77
78
78
79
79
function sorted_vertices (G:: VSafeGraph )
80
80
V = nv (G)
81
- marked = zeros (Int64 ,V)
82
- sv = zeros (Int64 ,0 )
81
+ marked = zeros (Int ,V)
82
+ sv = zeros (Int ,0 )
83
83
max_degree = - 1
84
84
max_degree_vertex = - 1
85
85
for i = 1 : V
@@ -100,8 +100,8 @@ function sorted_vertices(G::VSafeGraph)
100
100
end
101
101
102
102
# find uncolored vertex of maximal degree of saturation
103
- function find_uncolored_vertex (sv:: Array{Int64 ,1} , G:: VSafeGraph )
104
- colors = zeros (Int64 ,0 )
103
+ function find_uncolored_vertex (sv:: Array{Int ,1} , G:: VSafeGraph )
104
+ colors = zeros (Int ,0 )
105
105
max_colors = - 1
106
106
max_color_index = - 1
107
107
for i = 1 : nv (G)
@@ -116,7 +116,7 @@ function find_uncolored_vertex(sv::Array{Int64,1}, G::VSafeGraph)
116
116
max_color_index = i
117
117
end
118
118
end
119
- colors = zeros (Int64 ,0 )
119
+ colors = zeros (Int ,0 )
120
120
end
121
121
for i = 1 : nv (G)
122
122
if A[i] == max_color_index
@@ -127,8 +127,8 @@ function find_uncolored_vertex(sv::Array{Int64,1}, G::VSafeGraph)
127
127
end
128
128
129
129
# set of free colors of x, which are < optColorNumber
130
- function free_colors (x:: Int64 , F:: Array{Int64 ,1} , G:: VSafeGraph , max_color:: Int64 )
131
- colors = zeros (Int64 ,0 )
130
+ function free_colors (x:: Int , F:: Array{Int ,1} , G:: VSafeGraph , max_color:: Int )
131
+ colors = zeros (Int ,0 )
132
132
for color in 1 : max_color
133
133
present = true
134
134
for y in inneighbors (G,x)
@@ -145,7 +145,7 @@ function free_colors(x::Int64, F::Array{Int64,1}, G::VSafeGraph, max_color::Int6
145
145
end
146
146
147
147
# least index with F(A[i]) = optColorNumber
148
- function least_index (A:: Array{Int64 , 1} , F:: Array{Int64 ,1} , optColorNumber:: Int64 , G:: VSafeGraph )
148
+ function least_index (A:: Array{Int , 1} , F:: Array{Int ,1} , optColorNumber:: Int , G:: VSafeGraph )
149
149
for i = 1 : nv (G)
150
150
if F[A[i]] == optColorNumber
151
151
return i
@@ -154,15 +154,15 @@ function least_index(A::Array{Int64, 1}, F::Array{Int64,1}, optColorNumber::Int6
154
154
end
155
155
156
156
# uncolor all vertices A[i] with i >= start
157
- function uncolor_all (F:: Array{Int64 ,1} , A:: Array{Int64 ,1} , start:: Int64 , G:: VSafeGraph )
157
+ function uncolor_all (F:: Array{Int ,1} , A:: Array{Int ,1} , start:: Int , G:: VSafeGraph )
158
158
for i = start: nv (G)
159
159
F[A[i]] = 0
160
160
end
161
161
end
162
162
163
163
# remove from U all colors >= optColorNumber
164
- function remove_colors (U:: Array{Int64 ,1} , optColorNumber:: Int64 )
165
- modified_U = zeros (Int64 ,0 )
164
+ function remove_colors (U:: Array{Int ,1} , optColorNumber:: Int )
165
+ modified_U = zeros (Int ,0 )
166
166
for i = 1 : length (U)
167
167
if U[i] < optColorNumber
168
168
push! (mmodified_U, U[i])
0 commit comments