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

📄 graph.h

📁 模拟P2P各种网络环境的,适合新手们的学习,不错的源码.
💻 H
字号:
#ifndef _GRAPH_H
#define _GRAPH_H

#include "Common.h"
#include "Node.h"
#include "Link.h"

class Graph;
ostream &operator<<(ostream &os, const Graph &graph);

class Graph
{
private:
	unsigned int mAsNumber;
	
	string mCreator; /* Brite */
	string mComment; /* TopDown */
	string mGraphFile; /* xxxx.brite */
	
	bool mValid; /* default: invalid */
	
	vector<Node> mNode;
	map<string, Link> mLink;

	Node getNode(int id) const;
public:
	friend ostream &operator<<(ostream &os, const Graph &graph);
	Graph();
	void setGraphFile(string file);
	string getGraphFile() const ;
	void setComment(string comment);
	string getComment() const;
	void setCreator(string creator);
	string getCreator() const;
	
	void setValid(bool valid);
	bool isValid() const;
	
	void addNode(const Node &node);
	unsigned int getAsNumber() const;
	int getNodeNumber() const;
	void addLink(string key1, string key2, const Link &link);
	int getLinkNumber() const;
	map<string, Link> getAllLink() const;
	vector<Node> getAllNode() const;
	
	void fromBRITEFile(string file);
	void readBRITEGraph(string file);
};

#endif

⌨️ 快捷键说明

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