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

📄 lwgraph.cpp

📁 常用算法与数据结构原代码
💻 CPP
字号:
// test of linked adjacency list weighted graph class

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

void main(void)
{
   LinkedWDigraph<int> L(4);
	cout << "Edges = " << L.Edges() << endl;
	L.Add(2,4,1).Add(1,3,2).Add(2,1,3).Add(1,4,4).Add(4,2,5);
	cout << "The graph is" << endl;
	L.Output();
	L.Delete(2,1);
	cout << "The graph after deleting <2,1> is" << endl;
	L.Output();
	cout << "Exist(3,1) = " << L.Exist(3,1) << endl;
	cout << "InDegree(3) = " << L.InDegree(3) << endl;
	cout << "OutDegree(1) = " << L.OutDegree(1) << endl;
	cout << "Edges = " << L.Edges() << endl;
	int i=1,j,c;
	L.InitializePos();
	try
	{
		L.First(i,j,c);
		L.DeactivatePos();
		cout<<i<<"->"<<j<<' '<<c<<endl;
	}
	catch(...)
	{
		cout<<"Failed!"<<endl;
	}
}

⌨️ 快捷键说明

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