void
mstkruskal(AdjMultipleList *G)
{
    char ch[20];
    ArcNode *arcarray[G->vexnum-1];

    getplace2(G,ch);
    mst_kruskal(G,arcarray);
    show_kruskal(G,arcarray);

    return;
}
void city_tour()
{
  graph h; 
  edge *elist; 
  int nedge; 
  init_graph(&h); 
  h.read_node_attr = read_cityname;
  h.write_node_attr = write_cityname;
  h.read_edge_attr = read_distance;
  h.write_edge_attr = write_distance;

  if (read_graph(FILENAME, &h)) {
	print_graph(stdout, &h); 
	elist = (edge *) malloc(sizeof(edge) * (number_of_nodes(&h) - 1));
	nedge = mst_kruskal(&h, elist, get_distance);
  }
}
Exemplo n.º 3
0
int main(void)
{
    TGPtr pgraph;
    int nedge;
    int Edges[][3] = {
        {1, 2, 6}, {2, 1, 6}, {1, 3, 1}, {3, 1, 1},
        {1, 4, 5}, {4, 1, 5}, {2, 5, 3}, {5, 2, 3},
        {2, 3, 5}, {3, 2, 5}, {3, 4, 5}, {4, 3, 5},
        {3, 5, 6}, {5, 3, 6}, {3, 6, 4}, {6, 3, 4},
        {4, 6, 2}, {6, 4, 2}, {5, 6, 6}, {6, 5, 6}
    };

    nedge = sizeof(Edges)/sizeof(Edges[0]);
    //printf("%d\n", vexcnt(Edges, nedge));

    pgraph = gcreate(Edges, nedge);

    mst_kruskal(pgraph);
    output_mst(pgraph);

    destroy_graph(pgraph);
    system("pause");
    return 0;
}
Exemplo n.º 4
0
void graph(void) {
	subnet_cache_flush();
	sssp_bfs();
	mst_kruskal();
	graph_changed = true;
}