莫名其妙就好了

This commit is contained in:
iridiumR 2021-12-10 00:38:46 +08:00
parent 6099cd16c8
commit 5e4567ba3a

View file

@ -53,7 +53,7 @@ class graphVertex
{
private:
Vector<Vertex<Tv> *> V;
Vector<Edge<Te> *> E;
Vector<Vector<Edge<Te> *>> E;
int v;
int e;
@ -121,14 +121,14 @@ public:
// 0 成功
virtual int link(int id1, int id2, int w)
{
// if (V[id1] == NULL || V[id2] == NULL)
// return -1;
// if (E[id1][id2] != NULL)
// return -2;
if (V[id1] == NULL || V[id2] == NULL)
return -1;
if (E[id1][id2] != NULL)
return -2;
V[id1]->outDegree++;
V[id2]->inDegree++;
Edge<Te> *temp = new Edge<Te>(w);
(E->_v[id1])->_v[id2] = temp;
(E._v[id1])._v[id2] = temp;
return 0;
}
// 解除 id1->id2 连接