Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prakashsellathurai/0f448363387ddfc0471e0a14616071e2 to your computer and use it in GitHub Desktop.
Save prakashsellathurai/0f448363387ddfc0471e0a14616071e2 to your computer and use it in GitHub Desktop.
floydwarshall algorithm
void FloydWarshall(int distance[maxVertices][maxVertices],int vertices)
{
int from,to,via;
for(from=0;from<vertices;from++)
{
for(to=0;to<vertices;to++)
{
for(via=0;via<vertices;via++)
{
distance[from][to] = min(distance[from][to],
distance[from][via]+distance[via][to]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment