我有两个结构
struct Edge{
int v1;
int v2;
int weigt;
Edge(int v1_tmp, int v2_tmp, int weight_tmp);
};
struct GraphList{
int V;
int E;
list<Edge>* mylist;
}
GraphList::GraphList(GrafMatrix* graph){
V=graph->V;
E=graph->E;
for (int i=0; i<V; i++){
for (int j=0; j<V; j++){
if (graph->matrix[i][j]==1) mylist[i].push_back( Edge(i+1, j+1, graf->weights[i][j]) );
}
}
}
怎么了?当i=0
和时j=1
,有一个错误。我试过lista = new list<Krawedz>()
了,但它不起作用。有任何想法吗?