You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if p == v && q != w # vw, vq ∈ E and color[w] = color[q]
205
202
star_vq = star[index_pq]
206
203
hub[star_vq] = v # this may already be true
207
-
nb_spokes[star_vq] +=1
208
204
star[index_vw] = star_vq
209
205
else# vw forms a new star
210
206
push!(hub, -max(v, w)) # star is trivial (composed only of two vertices) so we set the hub to a negative value, but it allows us to choose one of the two vertices
211
-
push!(nb_spokes, 1)
212
207
star[index_vw] =length(hub)
213
208
end
214
209
end
@@ -230,50 +225,6 @@ struct StarSet
230
225
star::Vector{Int}
231
226
"a mapping from star indices to their hub (undefined hubs for single-edge stars are the negative value of one of the vertices, picked arbitrarily)"
232
227
hub::Vector{Int}
233
-
"a mapping from star indices to the vector of their spokes"
234
-
spokes::Vector{Vector{Int}}
235
-
end
236
-
237
-
functionStarSet(
238
-
g::AdjacencyGraph,
239
-
star::Vector{Int},
240
-
hub::Vector{Int},
241
-
nb_spokes::Vector{Int},
242
-
color::Vector{Int},
243
-
edge_to_index::Vector{Int},
244
-
)
245
-
S =pattern(g)
246
-
n = S.n
247
-
248
-
# Create a list of spokes for each star, preallocating their sizes based on nb_spokes
249
-
spokes = [Vector{Int}(undef, ns) for ns in nb_spokes]
250
-
251
-
# Reuse nb_spokes as counters to track the current index while filling the spokes
252
-
fill!(nb_spokes, 0)
253
-
254
-
rvS =rowvals(S)
255
-
for j inaxes(S, 2)
256
-
for k innzrange(S, j)
257
-
i = rvS[k]
258
-
if i > j
259
-
index_ij = edge_to_index[k]
260
-
s = star[index_ij]
261
-
h =abs(hub[s])
262
-
nb_spokes[s] +=1
263
-
index = nb_spokes[s]
264
-
265
-
# Assign the non-hub vertex (spoke) to the correct position in spokes
266
-
if i == h
267
-
# i is the hub and j is the spoke
268
-
spokes[s][index] = j
269
-
else# j == h
270
-
# j is the hub and i is the spoke
271
-
spokes[s][index] = i
272
-
end
273
-
end
274
-
end
275
-
end
276
-
returnStarSet(star, hub, spokes)
277
228
end
278
229
279
230
"""
@@ -384,7 +335,7 @@ function acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessin
384
335
tree_set =TreeSet(g, forest, edge_to_index)
385
336
if postprocessing
386
337
# Reuse the vector forbidden_colors to compute offsets during post-processing
0 commit comments