MCPcopy Create free account
hub / github.com/MyGUI/mygui / colorSecondDegreeGraph

Function colorSecondDegreeGraph

MyGUIEngine/src/msdfgen/core/edge-coloring.cpp:292–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292static void colorSecondDegreeGraph(int *coloring, const int *const *edgeMatrix, int vertexCount, unsigned long long seed) {
293 for (int i = 0; i < vertexCount; ++i) {
294 int possibleColors = 7;
295 for (int j = 0; j < i; ++j) {
296 if (edgeMatrix[i][j])
297 possibleColors &= ~(1<<coloring[j]);
298 }
299 int color = 0;
300 switch (possibleColors) {
301 case 1:
302 color = 0;
303 break;
304 case 2:
305 color = 1;
306 break;
307 case 3:
308 color = seedExtract2(seed); // 0 or 1
309 break;
310 case 4:
311 color = 2;
312 break;
313 case 5:
314 color = (int) !seedExtract2(seed)<<1; // 2 or 0
315 break;
316 case 6:
317 color = seedExtract2(seed)+1; // 1 or 2
318 break;
319 case 7:
320 color = (seedExtract3(seed)+i)%3; // 0 or 1 or 2
321 break;
322 }
323 coloring[i] = color;
324 }
325}
326
327static int vertexPossibleColors(const int *coloring, const int *edgeVector, int vertexCount) {
328 int usedColors = 0;

Callers 1

edgeColoringByDistanceFunction · 0.85

Calls 2

seedExtract2Function · 0.85
seedExtract3Function · 0.85

Tested by

no test coverage detected