#include <cstdlib>
#include <iostream>
#include <graphics.h>

int main()
{
           initwindow(1366, 768, "Prim's Algorithm");
    int midx,midy;
    //
/**************Node 0 creation***************/

     midx = (getmaxx()/12);
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 

     midx = (getmaxx()/12)-1;
      midy = (getmaxy()/12)-8 ;    
    //  setcolor(10);
     outtextxy(midx, midy,"0");

      /*******************Right Vertex******************/
      setcolor(15);
    midx = (getmaxx()/12) + 30;    
    midy = getmaxy()/12;
    line(midx+50,midy,midx,midy );
    outtextxy(midx+20,midy-20,"3");
/******************* Bottom Vertex at node  ******************/

    setcolor(15);
    midx = getmaxx()/12;   // to shift line left or right on x-axis
    midy = getmaxy()/12 - 50;   // to shift line up or down.
    line(midx,midy+124,midx,midy+60);       
    outtextxy(midx-10,midy+80,"5");
   /**************Node 1 creation***************/

     midx = (getmaxx()/6)-3;
     midy = (getmaxy()/6)-65;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 

     midx = (getmaxx()/6);
      midy = (getmaxy()/6)-72 ;    
      setcolor(10);
     outtextxy(midx, midy,"1");

/******************* Bottom Vertex at node 1-12 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+9;   // to shift line left or right on x-axis
    midy = (getmaxy()/6)-114 ;
    line(midx,midy+123,midx,midy+60);
     outtextxy(midx-10,midy+80,"7");
     /*******************1-2 Right Vertex******************/
      setcolor(15);
    midx = (getmaxx()/6) + 28;    
    midy = (getmaxy()/6) - 65;
    line(midx+48,midy,midx,midy );
     outtextxy(midx+20,midy-20,"2");
/**************Node 2 creation***************/

     midx = (getmaxx()/12)+220;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
     //setfillstyle(SOLID_FILL,n2);
     //floodfill(midx,midy,WHITE);
     midx = (getmaxx()/12)+220;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"2");
     //outtext weight

  /*******************2-3 Right Vertex******************/
      setcolor(15);
    midx = (getmaxx()/6) + 138;    
    midy = (getmaxy()/6) - 65;
    line(midx+52,midy,midx,midy );
     outtextxy(midx+25,midy-18,"4");
     /**************Node 3 creation***************/

     midx = (getmaxx()/6)+220;
     midy = (getmaxy()/6)-65;;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
     //setfillstyle(SOLID_FILL,n3);
     //floodfill(midx,midy,WHITE);
    /******** for 3 in rectangle ***********/

     midx = (getmaxx()/6)+220;
      midy = (getmaxy()/6)-71 ;    
      setcolor(10);
     outtextxy(midx, midy,"3");
//weight
 /******************* Bottom Vertex at node 3-14 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+220;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) - 115;
    line(midx,midy+125,midx,midy+60);
     outtextxy(midx-25,midy+80,"9");
  /*******************3-15 Arc Vertex******************/
      setcolor(15);
    midx = (getmaxx()/6) + 248;    
    midy = (getmaxy()/6) - 105;
    line(midx+50,midy+115,midx,midy+50);
     outtextxy(midx+5,midy+80,"10");
/**************Node 4 creation***************/

     midx = (getmaxx()/6)+330;
     midy = (getmaxy()/6)-65;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
//     setfillstyle(SOLID_FILL,n4);
  //   floodfill(midx,midy,WHITE);
    /******** for 4 in rectangle ***********/

     midx = (getmaxx()/6)+330;
      midy = (getmaxy()/6)-73 ;    
      setcolor(10);
     outtextxy(midx, midy,"4");
     //weight
       /******************* Bottom Vertex at node 4-15 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+330;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) - 55;
    line(midx,midy+65,midx,midy);
     outtextxy(midx-25,midy+20,"11");

   /******************* Right Vertex at node 4-5 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+361;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) - 65;
    line(midx+45,midy,midx,midy);
    outtextxy(midx+20,midy-20,"5");
        /**************Node 5 creation***************/

     midx = (getmaxx()/6)+436;
     midy = (getmaxy()/6)-64;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
    // setfillstyle(SOLID_FILL,n5);
    // floodfill(midx,midy,WHITE);
    /******** for 5 in rectangle ***********/

     midx = (getmaxx()/6)+438;
      midy = (getmaxy()/6)-70 ;    
      setcolor(10);
     outtextxy(midx, midy,"5");
     //weight
      /******************* Arc Vertex at node 5-17 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+465;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) - 113;
    line(midx+58,midy+122,midx,midy+58);
    outtextxy(midx,midy+80,"12");
     /**************Node 6 creation***************/

     midx = (getmaxx()/12)+660;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n6);
    // floodfill(midx,midy,WHITE);
    /******** for 6 in rectangle ***********/

     midx = (getmaxx()/12)+660;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"6");
   //  weight
      /******************* Bottom Vertex at node 6-17 ******************/

    setcolor(15);
    midx = getmaxx()/12+660;   // to shift line left or right on x-axis
    midy = getmaxy()/12 - 50;
    line(midx,midy+123,midx,midy+60);
    outtextxy(midx-20,midy+80,"13");
/************** Right Vertex at  node 6-7 ************************/
  setcolor(15);
    midx = (getmaxx()/12)+690;   // to shift line left or right on x-axis
    midy = (getmaxy()/12) + 3;
    line(midx+50,midy,midx,midy);
     outtextxy(midx+25,midy-20,"8");
     /************** Right Vertex at  node 6-7 ************************/
  setcolor(15);
    midx = (getmaxx()/12)+690;   // to shift line left or right on x-axis
    midy = (getmaxy()/12) + 3;
    line(midx+50,midy,midx,midy);

     /**************Node 7 creation***************/

     midx = (getmaxx()/12)+770;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n7);
    // floodfill(midx,midy,WHITE);
    /******** for 7 in rectangle ***********/

     midx = (getmaxx()/12)+770;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"7");
//weight
 /************** Right Vertex at  node 7-8 ************************/
  setcolor(15);
    midx = (getmaxx()/12)+800;   // to shift line left or right on x-axis
    midy = (getmaxy()/12) + 3;
    line(midx+50,midy,midx,midy);  
    outtextxy(midx+25,midy-20,"6");    
     /**************Node 8 creation***************/

     midx = (getmaxx()/12)+880;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n8);
    // floodfill(midx,midy,WHITE);
    /******** for 8 in rectangle ***********/

     midx = (getmaxx()/12)+880;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"8");
  //   weight
      /******************* Bottom Vertex at node 8-19 ******************/

    setcolor(15);
    midx = getmaxx()/12+880;   // to shift line left or right on x-axis
    midy = getmaxy()/12 - 50;
    line(midx,midy+123,midx,midy+60);
    outtextxy(midx-20,midy+80,"15");
    /************** Arc Vertex at  node 8-18 ************************/
  setcolor(15);
    midx = (getmaxx()/12)+840;   // to shift line left or right on x-axis
    midy = (getmaxy()/12) + 63;
    line(midx+10,midy-55,midx-35,midy+10);
     outtextxy(midx-30,midy-40,"14");   
     /**************Node 9 creation***************/

     midx = (getmaxx()/12)+990;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n9);
    // floodfill(midx,midy,WHITE);
    /******** for 9 in rectangle ***********/

     midx = (getmaxx()/12)+990;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"9");
  // weight
    /************** Bottom Vertex at  node 9-20 ************************/
  setcolor(15);
    midx = (getmaxx()/12)+997;   // to shift line left or right on x-axis
    midy = (getmaxy()/12) -48;
    line(midx,midy+122,midx,midy+60);   
    outtextxy(midx-25,midy+80,"16");  
     /**************Node 10 creation***************/

     midx = (getmaxx()/12)+1100;
     midy = (getmaxy()/12);
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n10);
     //floodfill(midx,midy,WHITE);
    /******** for 10 in rectangle ***********/

     midx = (getmaxx()/12)+1100;
      midy = (getmaxy()/12)-8 ;    
      setcolor(10);
     outtextxy(midx, midy,"10");
//weight
      /******************* Bottom Vertex at node 10-21 ******************/
    setcolor(15);
    midx = getmaxx()/12+1100;   // to shift line left or right on x-axis
    midy = getmaxy()/12 - 50;
    line(midx,midy+123,midx,midy+60);
    outtextxy(midx-25,midy+80,"17");
/**************Node 11 creation***************/

     midx = (getmaxx()/6)-116;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n11);
    // floodfill(midx,midy,WHITE);
    /******** for 11 in rectangle ***********/

     midx = (getmaxx()/6)-126;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"11");
//weight
/******************* Bottom Vertex at node 11-22  ******************/

    setcolor(15);
    midx = (getmaxx()/6)-116;   // to shift line left or right on x-axis
    midy = getmaxy()/12 +35;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);       
    outtextxy(midx-25,midy+80,"23");

/**************Node 12 creation***************/

     midx = (getmaxx()/6);
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n12);
    // floodfill(midx,midy,WHITE);
    /******** for 12 in rectangle ***********/

     midx = (getmaxx()/6);
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"12");
   //  weight
      /******************* Right Vertex at node 12-13  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+30;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +20;   // to shift line up or down.
    line(midx+50,midy,midx,midy); 
     outtextxy(midx+15,midy-20,"18");
    /******************* Bottom Vertex at node 12-23 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+10;   // to shift line left or right on x-axis
    midy = getmaxy()/12 +35;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);       
    outtextxy(midx-25,midy+80,"24"); 

/**************Node 13 creation***************/

   midx = (getmaxx()/6)+110;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n13);
    // floodfill(midx,midy,WHITE);
    /******** for 13 in rectangle ***********/

     midx = (getmaxx()/6)+110;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"13");
    // weight
      /******************* Bottom Vertex at node 13-24 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+120;   // to shift line left or right on x-axis
    midy = getmaxy()/12 +35;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);   
    outtextxy(midx-25,midy+80,"25");
/**************Node 14 creation***************/

   midx = (getmaxx()/6)+220;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n14);
    // floodfill(midx,midy,WHITE);
    /******** for 14 in rectangle ***********/

     midx = (getmaxx()/6)+220;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"14");
    // weight
      /******************* Bottom Vertex at node 14-25 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+220;   // to shift line left or right on x-axis
    midy = getmaxy()/12 +35;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);
     outtextxy(midx-25,midy+80,"22");   
     /**************Node 15 creation***************/

   midx = (getmaxx()/6)+330;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n15);
    // floodfill(midx,midy,WHITE);
    /******** for 15 in rectangle ***********/

     midx = (getmaxx()/6)+330;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"15");
//weight
 /******************* Right Vertex at node 15-16 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+360;   // to shift line left or right on x-axis
    midy = getmaxy()/12 +85;   // to shift line up or down.
    line(midx+50,midy,midx,midy); 
     outtextxy(midx+15,midy-20,"19");  
/**************Node 16 creation***************/

   midx = (getmaxx()/6)+440;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n16);
     //floodfill(midx,midy,WHITE);
    /******** for 16 in rectangle ***********/

     midx = (getmaxx()/6)+440;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"16");
    // weight
      /************** Arc Vertex at  node 16-28 ************************/
  setcolor(15);
    midx = (getmaxx()/6)+470;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) -28;   // to shift line up or down.
    line(midx+55,midy+118,midx+0,midy+60);       
    outtextxy(midx+2,midy+80,"27");

     /**************Node 17 creation***************/

   midx = (getmaxx()/6)+550;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n17);
     //floodfill(midx,midy,WHITE);
    /******** for 17 in rectangle ***********/

     midx = (getmaxx()/6)+550;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"17");//weight
     /************** right vertex at node 17-18 *********/
     setcolor(15);
    midx = (getmaxx()/6)+580;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +20;   // to shift line up or down.
    line(midx+50,midy,midx,midy);  
    outtextxy(midx+15,midy-20,"20");     
     /**************Node 18 creation***************/

   midx = (getmaxx()/6)+660;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n18);
     //floodfill(midx,midy,WHITE);
    /******** for 18 in rectangle ***********/

     midx = (getmaxx()/6)+660;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"18");
    // weight
     /******************* Bottom Vertex at node 18-29  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+670;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) -30;   // to shift line up or down.
    line(midx,midy+120,midx,midy+60);       
    outtextxy(midx-20,midy+80,"28");

     /**************Node 19 creation***************/

   midx = (getmaxx()/6)+770;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n19);
     //floodfill(midx,midy,WHITE);
    /******** for 19 in rectangle ***********/

     midx = (getmaxx()/6)+770;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"19");
//weight
     /******************* Bottom Vertex at node 19-30  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+770;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) -30;   // to shift line up or down.
    line(midx,midy+120,midx,midy+60);       
   outtextxy(midx-20,midy+80,"29");

     /******************* Right Vertex at node 19-20 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+800;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +20;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
    outtextxy(midx+15,midy-20,"21");
/**************Node 20 creation***************/

   midx = (getmaxx()/6)+880;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n20);
     //floodfill(midx,midy,WHITE);
    /******** for 20 in rectangle ***********/

     midx = (getmaxx()/6)+880;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"20");
  //   weight
     /******************* Right Vertex at node 20-21 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+910;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +20;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
    outtextxy(midx+15,midy-20,"22");

     /**************Node 21 creation***************/

   midx = (getmaxx()/6)+990;
     midy = (getmaxy()/6)+20;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n21);
     //floodfill(midx,midy,WHITE);
    /******** for 21 in rectangle ***********/

     midx = (getmaxx()/6)+990;
      midy = (getmaxy()/6)+12 ;    
      setcolor(10);
     outtextxy(midx, midy,"21");
//weight
      /******************* Bottom Vertex at node 21-32  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+990;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) -30;   // to shift line up or down.
    line(midx,midy+120,midx,midy+60);       
   outtextxy(midx-20,midy+80,"30");


/**************Node 22 creation***************/

   midx = (getmaxx()/6)-120;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n22);
     //floodfill(midx,midy,WHITE);
    /******** for 22 in rectangle ***********/

     midx = (getmaxx()/6)-120;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"22");
   /*****************Right Vertex at node 22-23 ********************/
     setcolor(15);
     midx =(getmaxx()/6)-90;
     midy =(getmaxy()/6)+100;
     line(midx+60,midy,midx,midy);
    outtextxy(midx+15,midy-20,"17"); 
     /******************* Bottom Vertex at node 22-33  ******************/

    setcolor(15);
    midx = (getmaxx()/6)-116;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +51;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);     
   outtextxy(midx-20,midy+80,"18"); 
    /******************* ARC Vertex at node 22-34 ******************/

    setcolor(15);
    midx = (getmaxx()/6)-90;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +51;   // to shift line up or down.
    line(midx+60,midy+118,midx+0,midy+60);         
   outtextxy(midx+5,midy+80,"19");
/**************Node 23 creation***************/

   midx = (getmaxx()/6);
     midy = (getmaxy()/6)+100;
     rectangle(midx +30, midy-10, midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n23);
     //floodfill(midx,midy,WHITE);
    /******** for 23 in rectangle ***********/

     midx = (getmaxx()/6);
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"23");
//weight
/******************* ARC Vertex at node 23-35 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+30;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +51;   // to shift line up or down.
    line(midx+55,midy+118,midx+0,midy+60);       
   outtextxy(midx+5,midy+80,"20");
/**************Node 24 creation***************/

   midx = (getmaxx()/6)+113;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n24);
     //floodfill(midx,midy,WHITE);
    /******** for 24 in rectangle ***********/

     midx = (getmaxx()/6)+113;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"24");
    // weight
      /******************* Right Vertex at node 24-25  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+143;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +103;   // to shift line up or down.
    line(midx+50,midy,midx,midy);  
    outtextxy(midx+15,midy-20,"32");
/**************Node 25 creation***************/

   midx = (getmaxx()/6)+223;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n25);
     //floodfill(midx,midy,WHITE);
    /******** for 25 in rectangle ***********/

     midx = (getmaxx()/6)+223;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"25");
    // weight
      /******************* Right Vertex at node 25-26  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+253;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +103;   // to shift line up or down.
    line(midx+50,midy,midx,midy);  
    outtextxy(midx+15,midy-20,"33");
/**************Node 26 creation***************/

   midx = (getmaxx()/6)+333;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n26);
     //floodfill(midx,midy,WHITE);
    /******** for 26 in rectangle ***********/

     midx = (getmaxx()/6)+333;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"26");
    // weight
     /******************* ARC Vertex at node 26-38 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+360;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +50;   // to shift line up or down.
    line(midx+55,midy+118,midx+0,midy+60); 
   outtextxy(midx+5,midy+80,"6"); 
    /******************* Bottom Vertex at node 26-37 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+340;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +51;   // to shift line up or down.
    line(midx,midy+118,midx,midy+60);             
   outtextxy(midx-20,midy+80,"12");  
      /******************* Right Vertex at node 26-27  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+363;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +103;   // to shift line up or down.
    line(midx+50,midy,midx,midy);
   outtextxy(midx+15,midy-20,"3");   
     /**************Node 27 creation***************/

   midx = (getmaxx()/6)+443;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n27);
     //floodfill(midx,midy,WHITE);
    /******** for 27 in rectangle ***********/

     midx = (getmaxx()/6)+443;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"27");
   //  weight
      /******************* Right Vertex at node 27-28  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+473;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +103;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
   outtextxy(midx+15,midy-20,"12");  
     /**************Node 28 creation***************/

   midx = (getmaxx()/6)+553;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n28);
     //floodfill(midx,midy,WHITE);
    /******** for 28 in rectangle ***********/

     midx = (getmaxx()/6)+553;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"28");
  //   weight
      /******************* Bottom Vertex at node  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+550;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +110;   // to shift line up or down.
    line(midx,midy,midx,midy+60);       
   outtextxy(midx-20,midy+30,"14");  
     /**************Node 29 creation***************/

   midx = (getmaxx()/6)+663;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n29);
     //floodfill(midx,midy,WHITE);
    /******** for 29 in rectangle ***********/

     midx = (getmaxx()/6)+663;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"29");
   //  weight
      /******************* Right Vertex at node 29-30  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+693;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +100;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
   outtextxy(midx+15,midy-20,"12");

     /**************Node 30 creation***************/

   midx = (getmaxx()/6)+773;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
//   setfillstyle(SOLID_FILL,n30);
  //   floodfill(midx,midy,WHITE);
    /******** for 30 in rectangle ***********/

     midx = (getmaxx()/6)+773;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"30");
    // weight
      /******************* Right Vertex at node 30-31  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+803;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +100;   // to shift line up or down.
    line(midx+50,midy,midx,midy);           
   outtextxy(midx+15,midy-20,"10");
     /**************Node 31 creation***************/

   midx = (getmaxx()/6)+883;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n31);
     //floodfill(midx,midy,WHITE);
    /******** for 31 in rectangle ***********/

     midx = (getmaxx()/6)+883;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"31");
   //  weight
     /******************* Bottom Vertex at node 31-42  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+885;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +50;   // to shift line up or down.
    line(midx,midy+120,midx,midy+60);   
   outtextxy(midx-20,midy+80,"6");
    /******************* Right Vertex at node 31-32  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+912;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +100;   // to shift line up or down.
    line(midx+50,midy,midx,midy);   
   outtextxy(midx+15,midy-20,"9"); 
        /**************Node 32 creation***************/

   midx = (getmaxx()/6)+993;
     midy = (getmaxy()/6)+100;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n32);
     //floodfill(midx,midy,WHITE);
    /******** for 32 in rectangle ***********/

     midx = (getmaxx()/6)+993;
      midy = (getmaxy()/6)+93 ;    
      setcolor(10);
     outtextxy(midx, midy,"32");
    // weight
       /******************* Bottom Vertex at node 32-43  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+995;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +50;   // to shift line up or down.
    line(midx,midy+120,midx,midy+60);   
   outtextxy(midx-20,midy+80,"11");  
   /**************Node 33 creation***************/

   midx = (getmaxx()/6)-120;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n33);
     //floodfill(midx,midy,WHITE);
    /******** for 33 in rectangle ***********/

     midx = (getmaxx()/6)-120;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"33");
//weight
     /******************* ARC Vertex at node 33-45 ******************/

    setcolor(15);
    midx = (getmaxx()/6)-91;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +119;   // to shift line up or down.
    line(midx+64,midy+122,midx+0,midy+70);
    outtextxy(midx+5,midy+88,"11");
    /******************* Bottom Vertex at node 33-44 ******************/

    setcolor(15);
    midx = (getmaxx()/6)-115;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +130;   // to shift line up or down.
    line(midx,midy+110,midx,midy+60);              
   outtextxy(midx-20,midy+80,"13");

 /**************Node 34 creation***************/

   midx = (getmaxx()/6);
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n34);
     //floodfill(midx,midy,WHITE);
    /******** for 34 in rectangle ***********/

     midx = (getmaxx()/6);
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"34");
    // weight


      /**************Node 35 creation***************/

   midx = (getmaxx()/6)+115;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 

    /******** for 35 in rectangle ***********/

     midx = (getmaxx()/6)+111;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"35");
//weight
/******************* Right Vertex at node 35-36  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+145;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +178;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
   outtextxy(midx+15,midy-20,"10");


 /**************Node 36 creation***************/

   midx = (getmaxx()/6)+225;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n36);
   //  floodfill(midx,midy,WHITE);
    /******** for 36 in rectangle ***********/

     midx = (getmaxx()/6)+221;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"36");

     /******************* Bottom Vertex at node 36-48 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+240;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +120;   // to shift line up or down.
    line(midx+60,midy+120,midx+15,midy+70);       
   outtextxy(midx+15,midy+90,"8");

   /**************Node 37 creation***************/
     midx = (getmaxx()/6)+335;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n37);
   //  floodfill(midx,midy,WHITE);
    /******** for 37 in rectangle ***********/

     midx = (getmaxx()/6)+331;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"37");

 /******************* Bottom Vertex at node 37-49 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+350;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +120;   // to shift line up or down.
    line(midx+60,midy+120,midx+15,midy+70);       
    outtextxy(midx+15,midy+90,"16");
 /**************Node 38 creation***************/

   midx = (getmaxx()/6)+445;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n38);
    // floodfill(midx,midy,WHITE);
    /******** for 38 in rectangle ***********/

     midx = (getmaxx()/6)+441;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"38");
   //  weight

      /**************Node 39 creation***************/

   midx = (getmaxx()/6)+555;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n39);
   //  floodfill(midx,midy,WHITE);
    /******** for 39 in rectangle ***********/

     midx = (getmaxx()/6)+551;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"39");
  //   weight
     /******************* Bottom Vertex at node 39-50 ******************/

    setcolor(15);
    midx = (getmaxx()/6)+550;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +190;   // to shift line up or down.
    line(midx,midy,midx,midy+50);    
    outtextxy(midx-25,midy+10,"12");
   /******************* Right Vertex at node 39-40  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+585;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +180;   // to shift line up or down.
    line(midx+50,midy,midx,midy);          
    outtextxy(midx+20,midy-17,"5");
      /**************Node 40 creation***************/

   midx = (getmaxx()/6)+665;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n40);
   //  floodfill(midx,midy,WHITE);
    /******** for 40 in rectangle ***********/

     midx = (getmaxx()/6)+661;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"40");

     /******************* Right Vertex at node 40-41  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+695;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +180;   // to shift line up or down.
    line(midx+50,midy,midx,midy);          
   outtextxy(midx+20,midy-17,"13");
 /**************Node 41 creation***************/

   midx = (getmaxx()/6)+775;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n41);
     //floodfill(midx,midy,WHITE);
    /******** for 41 in rectangle ***********/

     midx = (getmaxx()/6)+771;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"41");

     /******************* Right Vertex at node 41-42  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+805;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +180;   // to shift line up or down.
    line(midx+50,midy,midx,midy);          
   outtextxy(midx+20,midy-17,"8");
 /**************Node 42 creation***************/

   midx = (getmaxx()/6)+885;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n42);
     //floodfill(midx,midy,WHITE);
    /******** for 42 in rectangle ***********/

     midx = (getmaxx()/6)+881;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"42");

     /******************* Right Vertex at node 42-43  ******************/
    setcolor(15);
    midx = (getmaxx()/6)+915;  
     // to shift line left or right on x-axis
    midy = (getmaxy()/6) +180;   // to shift line up or down.
    line(midx+50,midy,midx,midy);          
    outtextxy(midx+20,midy-17,"8");
 /**************Node 43 creation***************/

   midx = (getmaxx()/6)+995;
     midy = (getmaxy()/6)+180;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n43);
    // floodfill(midx,midy,WHITE);
    /******** for 43 in rectangle ***********/

     midx = (getmaxx()/6)+991;
      midy = (getmaxy()/6)+173 ;    
      setcolor(10);
     outtextxy(midx, midy,"43");

/**************Node 44 creation***************/

   midx = (getmaxx()/6)-120;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
  // setfillstyle(SOLID_FILL,n44);
  //   floodfill(midx,midy,WHITE);
    /******** for 44 in rectangle ***********/

     midx = (getmaxx()/6)-120;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"44");

     /******************* Right Vertex at node 44-45  ******************/

    setcolor(15);
    midx = (getmaxx()/6)-90;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+60,midy,midx,midy);          
   outtextxy(midx+20,midy-17,"12");


/**************Node 45 creation***************/

   midx = (getmaxx()/6);
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n45);
     //floodfill(midx,midy,WHITE);
    /******** for 45 in rectangle ***********/

     midx = (getmaxx()/6);
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"45");

     /******************* Right Vertex at node 45-46  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+31;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+59,midy,midx,midy);          
    outtextxy(midx+20,midy-17,"5");
  /**************Node 46 creation***************/

   midx = (getmaxx()/6)+120;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n6);
     //floodfill(midx,midy,WHITE);
    /******** for 46 in rectangle ***********/

     midx = (getmaxx()/6)+120;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"46");

     /******************* Right Vertex at node 46-47  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+150;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+39,midy,midx,midy);          
    outtextxy(midx+20,midy-17,"2");
  /**************Node 47 creation***************/

   midx = (getmaxx()/6)+220;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n47);
     //floodfill(midx,midy,WHITE);
    /******** for 47 in rectangle ***********/

     midx = (getmaxx()/6)+220;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"47");

     /******************* Right Vertex at node 47-48  ******************/

    setcolor(15);
    midx = (getmaxx()/6)+251;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+49,midy,midx,midy);          
   outtextxy(midx+20,midy-17,"2");  
  /**************Node 48 creation***************/

   midx = (getmaxx()/6)+330;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n48);
     //floodfill(midx,midy,WHITE);
    /******** for 48 in rectangle ***********/

     midx = (getmaxx()/6)+330;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"48");
     /************** Right vertex at 48-49 ******/
     setcolor(15);
    midx = (getmaxx()/6)+360;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+50,midy,midx,midy);       
    outtextxy(midx+20,midy-17,"3");


  /**************Node 49 creation***************/

   midx = (getmaxx()/6)+440;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
   //setfillstyle(SOLID_FILL,n49);
     //floodfill(midx,midy,WHITE);
    /******** for 49 in rectangle ***********/

     midx = (getmaxx()/6)+440;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"49");

/************** Right vertex at 49-50 ******/
     setcolor(15);
    midx = (getmaxx()/6)+480;   // to shift line left or right on x-axis
    midy = (getmaxy()/6) +250;   // to shift line up or down.
    line(midx+40,midy,midx-10,midy);       
    outtextxy(midx+20,midy-17,"1");

  /**************Node 50 creation***************/

   midx = (getmaxx()/6)+550;
     midy = (getmaxy()/6)+250;
     rectangle(midx + 30,midy-10,midx - 30,midy+10); 
 //  setfillstyle(SOLID_FILL,n50);
   //  floodfill(midx,midy,WHITE);
    /******** for 50 in rectangle ***********/

     midx = (getmaxx()/6)+550;
      midy = (getmaxy()/6)+244 ;    
      setcolor(10);
     outtextxy(midx, midy,"50");


     system("pause");
     }

i've to implement prims algorithm on this graph which i've created. now i stuck on how to find cost. what i want is to visit all nodes and program should update the cost. can u help me??

Why don't you use functions to call each node? If you need data that you have aldready use, then why don't you use arrays? Make your code a little bit more readable.

Asking people to analyze 1100+ lines of code is not reasonable! As teo236 said, break it up into functions, and then identify those you are having problems with.

oh...i got it... thanks for helping me. and sorry for such a big code. actually i'm working first time in graphics liberary i hope u'll help me in future. Thanks again :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.