⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcolor.cpp

📁 图论:图的M着色问题 GraphM.h GraphOpr.h mColor.cpp mColor.dsp mColor.dsw mColor.h mColor.ncb mColor.o
💻 CPP
字号:
#include <iostream.h>
#include <stdlib.h>

#include "mColor.h"
#include "GraphOpr.h"



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

  filename = new char[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 m;
  int *C;
  C = new int[G->n()];
  for (int i = 0; i < G->n(); i++)
	C[i] = WHITE;
  cout << "Input the number of colors:" << endl;
  do{cin >> m;}
  while(m <= 0);
  i = 0;
  a = 0;
  mColor(G, i, m, C);
  cout << "Methods of " << m << " Coloring: " << a << endl;
}

⌨️ 快捷键说明

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