From: yu.dongliang <18588496441@163.com> Date: Fri, 3 Nov 2023 09:27:23 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=052164a496ecd0ef56af356335d14e52238740a3;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index 020eaf6..b0afd4e 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1256,23 +1256,54 @@ int ses_cross(ScfEfunction* f, int d) ses_edge_t* edge; - intptr_t N = 4; + intptr_t N = 2; intptr_t i; + intptr_t j; scf_loge("\n"); __ses_get_crosses(f, d, graph); - for (i = 1; i <= N; i++) - scf_vector_add(colors, (void*)i); + if (0 < graph->size) { + edge = graph->data[0]; - int ret = ses_cross_graph_kcolor(graph, N, colors); - if (ret < 0) { - scf_loge("**********\n"); + N = edge->crosses->size; + } + + for (j = N; j >= 0; j--) { + + for (i = 1; i <= j; i++) + scf_vector_add(colors, (void*)i); + + int ret = ses_cross_graph_kcolor(graph, j, colors); + if (ret < 0) { + scf_loge("**********\n"); + } + + for (i = 0; i < graph->size; i++) { + edge = graph->data[i]; + + if (edge->color < 0) + break; + } + + if (i < graph->size) + break; + + for (i = 0; i < graph->size; i++) { + edge = graph->data[i]; + + edge->c->color = edge->color; + edge->color = 0; + } + + scf_vector_clear(colors, NULL); + printf("\n"); } for (i = 0; i < graph->size; i++) { edge = graph->data[i]; - scf_logi("i: %ld, c%ld->color: %ld\n", i, edge->c->id, edge->color); + + scf_logi("j: %ld, i: %ld, c%ld->color: %ld\n", j, i, edge->c->id, edge->c->color); } scf_vector_clear(graph, ( void (*)(void*) )ses_edge_free);