alonsosjumper

ejercicio 13 práctica 8

Aug 21st, 2011
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. void Puente(Grafo G,Grafo H,Grafo J,CiudadCostera c1,CiudadCostera c2,CiudadCostera c3,Ciudad *Puente1,Ciudad *Puente2,Ciudad *Puente3)
  2. {
  3. int i,j,min,aux=0;
  4. tCoste **A1,**A2,**A3;
  5. vertice **P1,**P2,**P3;
  6.  
  7. Floyd(G,&A1,&P1);
  8. Floyd(H,&A2,&P2);
  9. Floyd(J,&A3,&P3);
  10.  
  11. for(i=0;i<c1->numCiudades;i++)
  12. {
  13. for(j=0;j<G->numVert;j++)
  14. aux=aux+G->Costes[c1->Ciudades[i]][j];
  15. if(aux<min)
  16. {
  17. min=aux;
  18. *Puente1=c1->Ciudades[i];
  19. }
  20. aux=0;
  21. }
  22.  
  23. for(i=0;i<c2->numCiudades;i++)
  24. {
  25. for(j=0;j<H->numVert;j++)
  26. aux=aux+H->Costes[c2->Ciudades[i]][j];
  27. if(aux<min)
  28. {
  29. min=aux;
  30. *Puente2=c2->Ciudades[i];
  31. }
  32. aux=0;
  33. }
  34.  
  35. for(i=0;i<c3->numCiudades;i++)
  36. {
  37. for(j=0;j<J->numVert;j++)
  38. aux=aux+J->Costes[c3->Ciudades[i]][j];
  39. if(aux<min)
  40. {
  41. min=aux;
  42. *Puente3=c3->Ciudades[i];
  43. }
  44. aux=0;
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment