mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-17 19:41:36 +08:00
由于现阶段,需要先调节代码结构。因此暂时取消graph相关测试代码,后续再开发。
This commit is contained in:
parent
094e856a47
commit
232f288e8a
14
src/graph.c
14
src/graph.c
@ -152,7 +152,7 @@ static bool graph_bfs(struct _graph *self, uint32_t idx)
|
|||||||
{
|
{
|
||||||
self->_head->visited[i] = 0;
|
self->_head->visited[i] = 0;
|
||||||
}
|
}
|
||||||
printf("bfs start.\n");
|
// printf("bfs start.\n");
|
||||||
|
|
||||||
queue_t queue = queue_new();
|
queue_t queue = queue_new();
|
||||||
queue_init(queue, sizeof(uint32_t));
|
queue_init(queue, sizeof(uint32_t));
|
||||||
@ -171,16 +171,16 @@ static bool graph_bfs(struct _graph *self, uint32_t idx)
|
|||||||
queue->push(queue, &i);
|
queue->push(queue, &i);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->print_obj((char *)self->_head->obj + idx * self->_obj_size);
|
// self->print_obj((char *)self->_head->obj + idx * self->_obj_size);
|
||||||
printf("->");
|
// printf("->");
|
||||||
self->print_obj((char *)self->_head->obj + i * self->_obj_size);
|
// self->print_obj((char *)self->_head->obj + i * self->_obj_size);
|
||||||
printf(", ");
|
// printf(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
// printf("\n");
|
||||||
}
|
}
|
||||||
queue_free(&queue);
|
queue_free(&queue);
|
||||||
printf("bfs done.\n");
|
// printf("bfs done.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void test_graph_from_matrix(void)
|
|||||||
|
|
||||||
// graph->print(graph);
|
// graph->print(graph);
|
||||||
graph->from_matrix(graph, vertexs, matrix, size);
|
graph->from_matrix(graph, vertexs, matrix, size);
|
||||||
graph->print(graph);
|
// graph->print(graph);
|
||||||
|
|
||||||
graph->bfs(graph, 1);
|
graph->bfs(graph, 1);
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void test_graph_from_matrix(void)
|
|||||||
|
|
||||||
void test_graph(void)
|
void test_graph(void)
|
||||||
{
|
{
|
||||||
RUN_TEST(test_graph_new);
|
// RUN_TEST(test_graph_new);
|
||||||
// RUN_TEST(test_graph_print);
|
// RUN_TEST(test_graph_print);
|
||||||
RUN_TEST(test_graph_from_matrix);
|
// RUN_TEST(test_graph_from_matrix);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user