maxst.cpp

来自「图论:最大支撑树算法实现 GraphM.h GraphOpr.h MaxS」· C++ 代码 · 共 44 行

CPP
44
字号
#include <iostream.h>
#include <stdlib.h>

#include "MaxST.h"
#include "GraphOpr.h"

void main()
{
  Graph* G;
  FILE *fp;
  char filename[255];

  cout << "Filename:" << endl;

  cin >> filename;

  if ((fp = fopen(filename, "rt")) == NULL)
  {
    cout << "Unable to open file |" << filename << "|" << endl;
	cout << "To know file format, View sample.gph" << endl;
    exit(-1);
  }

  G = readGraph(fp);

  if (G == NULL)
  {
    cout << "Unable to create graph" << endl;
	cout << "To know file format, View sample.gph" << endl;
    exit(-1);
  }
  
  printGraph(G);

  int i;
  i = 0;
  Graph* max;
  max = new Graph(G->n());
  printGraph(max);
  MaxST(G, i, max);
  printGraph(max);
}
  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?