N = v->edges->size + 1;
}
- for (j = N; j >= 1; j--) {
+ for (j = 1; j <= N; j++)
+ scf_vector_add(colors, (void*)j);
- for (i = 1; i <= j; i++)
- scf_vector_add(colors, (void*)i);
+ for (j = N; j >= 2; j--) {
int ret = ses_graph_kcolor(graph, j, colors);
if (ret < 0) {
v->color = 0;
}
- scf_vector_clear(colors, NULL);
+ scf_vector_del(colors, (void*)j);
}
scf_vector_clear(graph, ( void (*)(void*) )ses_vertex_free);
scf_vector_free(graph);
+ graph = NULL;
+
+ N = j + 1;
+ scf_vector_add(colors, (void*)N);
+ scf_vector_add(colors, (void*)0);
+
+ for (i = 0; i < f->n_elines; i++) {
+ el = f->elines[i];
+
+ for (j = 0; j < colors->size; j++)
+ colors->data[j] = NULL;
+
+ for (j = 0; j + 1 < el->n_pins; j += 2) {
+ c = f->components[el->pins[j]];
+
+ ++colors->data[c->color];
+ }
+
+ intptr_t _j = 0;
+ intptr_t _n = (intptr_t)colors->data[_j];
+
+ if (_n > 1)
+ continue;
+
+ for (j = 1; j < colors->size; j++) {
+
+ if (_n < (intptr_t)colors->data[j]) {
+ _n = (intptr_t)colors->data[j];
+ _j = j;
+ }
+ }
+
+ if (0 == _j)
+ continue;
+
+ for (j = 0; j + 1 < el->n_pins; j += 2) {
+ c = f->components[el->pins[j]];
+
+ if (0 == c->color) {
+ scf_loge("c%ld->color: %ld --> %ld\n", c->id, c->color, _j);
+ c->color = _j;
+ }
+ }
+ }
+
scf_vector_free(colors);
colors = NULL;
- graph = NULL;
int x1 = 0;
- N = j + 1;
-
for (j = 1; j <= N; j++) {
intptr_t j0 = (j - 1) / 2;