?? graph.h
字號:
// Graph.h: interface for the Graph class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(GRAPH_H)
#define GRAPH_H
#define INIT_CAPACITY 20;
//#define INFINITY 2000;
#include "Result.h"
#include "DistSet.h"
#include "ArraySet.h"
#include "FHeap.h"
#include "PHeap.h"
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <time.h>
using namespace std;
struct Edge{
int node;
int cost;
Edge * next;
};
struct Node{
int degree;
Edge * e;
};
class Graph
{
public:
/*Initialized the graph from file*/
Graph(const char * fileName);
/*Initialized the graph randomly*/
Graph(int, int);
/*Initialized the graph from*/
Graph();
~Graph();
/*SSP Algorithm using Dijkstra*/
Result DijkstraSSP(int node, DistSet * dist_set);
Node * adj_list;
void testInput(void);
private:
/*increase the size of adj-listin the step of 20*/
void extendAdjList(int newlength);
/*Add a new edge into the graph*/
bool addNewEdge(int from, Edge * e);
void initialize(void);
void buildGraph(istream & is);
void clear(void);
bool isConnected(void);
void DFS(int startNode, bool* isVisited);
private:
/*number of edge*/
int edge_num;
int node_num;
int adj_length;
public:
int getNodeNum(void)
{
return node_num;
}
};
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -