tmp
authoryu.dongliang <18588496441@163.com>
Fri, 3 Nov 2023 09:27:23 +0000 (17:27 +0800)
committeryu.dongliang <18588496441@163.com>
Fri, 3 Nov 2023 09:27:23 +0000 (17:27 +0800)
ses_layout.c

index 020eaf6a5068fa5fbe9290ba5ce0c9ce506c9bca..b0afd4ec2c303c0e6af25bc3804a55ded3cc1c23 100644 (file)
@@ -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);