This commit is contained in:
iridiumR 2021-12-10 09:29:13 +08:00
parent 827e98e87a
commit 780a537e50

View file

@ -157,7 +157,7 @@ public:
virtual void display()
{
std::cout << std::left << std::setw(5) << " ";
std::cout << std::left << std::setw(14) << " ";
for (int i = 0; i < V._len; i++)
if (V[i] != NULL)
std::cout << std::setw(4) << i << std::setw(10) << V[i]->data;
@ -166,14 +166,16 @@ public:
if (V[i] != NULL)
{
std::cout << std::setw(4) << i << std::setw(10) << V[i]->data;
for (int j = 0; j < E[i]._len;j++)
for (int j = 0; j < V._len; j++)
if (V[j] != NULL)
{
if (E[i][j] == NULL)
std::cout << std::setw(14) << "-";
else
std::cout << std::setw(14) << E[i][j]->weight;
}
printf("\n");
}
}
};