glabel.cpp

来自「data structures, algorithms and Applicat」· C++ 代码 · 共 21 行

CPP
21
字号
// label components of an undirected graph

#include <iostream.h>
#include "ag.h"

void main(void)
{
   AdjacencyGraph G(7);
   cout << "enter number of edges" << endl;
   int i, e, u, v;
   cin >> e;
   for (i =1; i <= e; i++) {
      cout << "enter edge " << i << endl;
      cin >> u >> v;
      G.Add(u,v);}
   int L[8];
   cout << "Components = " << G.LabelComponents(L) << endl;
   for (i =1; i <= e; i++) cout << L[i] << ' ';
   cout << endl;
}

⌨️ 快捷键说明

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