Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Puente(Grafo G,Grafo H,Grafo J,CiudadCostera c1,CiudadCostera c2,CiudadCostera c3,Ciudad *Puente1,Ciudad *Puente2,Ciudad *Puente3)
- {
- int i,j,min,aux=0;
- tCoste **A1,**A2,**A3;
- vertice **P1,**P2,**P3;
- Floyd(G,&A1,&P1);
- Floyd(H,&A2,&P2);
- Floyd(J,&A3,&P3);
- for(i=0;i<c1->numCiudades;i++)
- {
- for(j=0;j<G->numVert;j++)
- aux=aux+G->Costes[c1->Ciudades[i]][j];
- if(aux<min)
- {
- min=aux;
- *Puente1=c1->Ciudades[i];
- }
- aux=0;
- }
- for(i=0;i<c2->numCiudades;i++)
- {
- for(j=0;j<H->numVert;j++)
- aux=aux+H->Costes[c2->Ciudades[i]][j];
- if(aux<min)
- {
- min=aux;
- *Puente2=c2->Ciudades[i];
- }
- aux=0;
- }
- for(i=0;i<c3->numCiudades;i++)
- {
- for(j=0;j<J->numVert;j++)
- aux=aux+J->Costes[c3->Ciudades[i]][j];
- if(aux<min)
- {
- min=aux;
- *Puente3=c3->Ciudades[i];
- }
- aux=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment