Content deleted Content added
vertex.predecessor doesn't make any sense -- v.predecessor, right? |
|||
Line 77:
void BellmanFord(Edge edges[], size_t edgecount, size_t nodecount, size_t source)
{
int i,j ;
int* distance = (int*) malloc(nodecount*sizeof(int));
for(
{
if(i == source) distance[i] = 0;
else distance[i] = INFINITY;
}
for(
{
for(
{
if(distance[edges[j].dest] > distance[edges[j].source] + edges[j].weight)
Line 101 ⟶ 102:
}
}
for(
{
printf("The shortest distance between nodes %i and %i is %i", source, i, distance[i]);
|