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

📄 linkedlistforgraph.h

📁 data+structures+using+c的源码
💻 H
字号:
#ifndef H_LinkedListForGraph
#define H_LinkedListForGraph

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

using namespace std;

template<class vType>
class linkedListGraph: public linkedListType<vType>
{ 
public:
    void getAdjacentVertices(vType adjacencyList[], 
                             int& length);
      //Function to retrieve the vertices adjacent to a given 
      //vertex.
      //Postcondition: The vertices adjacent to a given vertex 
      //               are retrieved in the array adjacencyList. 
      //               The parameter length specifies the number 
      //               of vertices adjacent to a given vertex.
};

template<class vType>
void linkedListGraph<vType>::getAdjacentVertices
      			    (vType adjacencyList[], int& length)
{
	nodeType<vType> *current;

	length = 0;
	current = first;

	while(current != NULL)
	{
		adjacencyList[length++] = current->info;
		current = current->link;
	}
}

#endif

⌨️ 快捷键说明

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