tmp
authoryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 08:55:24 +0000 (16:55 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 08:55:24 +0000 (16:55 +0800)
ses_graph.c

index 89080a13e1decf5912a7cfe910629ddd83d5420f..3c09d4af85760788aa056a847c35904e69e3d1de 100644 (file)
@@ -1,4 +1,5 @@
 #include"ses_graph.h"
+#include"ses_core.h"
 
 ses_vertex_t* ses_vertex_alloc()
 {
@@ -222,6 +223,9 @@ static int __find_not_neighbor(scf_vector_t* graph, int k, ses_vertex_t** pp0, s
        for (i = 0; i < graph->size; i++) {
                v0        = graph->data[i];
 
+               ScfEcomponent* c0 = v0->data;
+               scf_loge("graph->size: %d, k: %d, c%ld->edges->size: %d\n", graph->size, k, c0->id, v0->edges->size);
+
                if (v0->edges->size > k)
                        continue;
 
@@ -230,6 +234,9 @@ static int __find_not_neighbor(scf_vector_t* graph, int k, ses_vertex_t** pp0, s
                for (j = i + 1; j < graph->size; j++) {
                        v1            = graph->data[j];
 
+                       ScfEcomponent* c1 = v1->data;
+                       scf_logi("graph->size: %d, k: %d, c%ld->edges->size: %d\n", graph->size, k, c1->id, v1->edges->size);
+
                        if (!scf_vector_find(v0->edges, v1)) {
                                assert(!scf_vector_find(v1->edges, v0));
                                break;
@@ -237,6 +244,7 @@ static int __find_not_neighbor(scf_vector_t* graph, int k, ses_vertex_t** pp0, s
 
                        v1 = NULL;
                }
+               printf("\n");
 
                if (v1) {
                        *pp0 = v0;
@@ -265,6 +273,7 @@ static ses_vertex_t* __max_neighbors(scf_vector_t* graph)
                }
        }
 
+       scf_loge("\n");
        return max;
 }
 
@@ -279,7 +288,7 @@ static int __graph_kcolor(scf_vector_t* graph, int k, scf_vector_t* colors)
        if (!deleted)
                return -ENOMEM;
 
-       scf_logd("graph->size: %d, k: %d\n", graph->size, k);
+       scf_logw("graph->size: %d, k: %d\n", graph->size, k);
 
        int ret = __kcolor_delete(graph, k, deleted);
        if (ret < 0)
@@ -293,6 +302,7 @@ static int __graph_kcolor(scf_vector_t* graph, int k, scf_vector_t* colors)
 
                scf_vector_free(deleted);
                deleted = NULL;
+               scf_logw("graph->size: %d, k: %d\n\n", graph->size, k);
                return 0;
        }
 
@@ -312,6 +322,10 @@ static int __graph_kcolor(scf_vector_t* graph, int k, scf_vector_t* colors)
                        goto overflow;
                v1->color = v0->color;
 
+               ScfEcomponent* c0 = v0->data;
+               ScfEcomponent* c1 = v1->data;
+               scf_logi("graph->size: %d, k: %d, c%ld, c%ld, color: %ld\n", graph->size, k, c0->id, c1->id, v0->color);
+
                __color_del(__colors, v0->color);
 
                ret = __graph_del(graph, v0);
@@ -363,6 +377,7 @@ overflow:
 
        scf_vector_free(deleted);
        deleted = NULL;
+       scf_logw("graph->size: %d, k: %d\n\n", graph->size, k);
        return 0;
 
 error: