linkedlistforgraph.h
来自「data+structures+using+c的源码」· C头文件 代码 · 共 40 行
H
40 行
#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 + =
减小字号Ctrl + -
显示快捷键?