我选的C,如果被要求写一个graph的拷贝题,要写代码,请问我下面的代码可不可以。
是太简略了呢,还是没有必要这么详细定义结构体,请有经验的人指教。多谢了!
Typedef struct T_vertext
{
Int data;
Int color;
Int d;
LIST *adj;
} VERTEX;
Typedef struct T_list
{
VERTEX* v;
Struct T_list *next;
} LIST;
VERTEX *G1; /*assume it has been already initialized to includes all vertex
in G1*/
VERTEX *G2; //the new graph that is going to be created.
QUEUE q;
For each vertex in G1:
{
Vertex.color = WHITE;
Vertex.d = 0;
}
S = G1.getVertex(0);
Enqueue(q, s);