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

📄 analyzer_degree.cpp

📁 clustering for ns-2 simulation
💻 CPP
字号:
#include "analyzer_degree.h"void analyze_degree(string topologyDirectory,					int nodi,					map<int, int> & degree_id, 					map<int, int> & degree_degree,					map<int, int> & degree_altro){	Graph graph;		degree_id.clear();	degree_degree.clear();		int tmp1, tmp2, i;	for (i = 0; i < 300; i++) {		string tmpFile;		ostringstream fileName(tmpFile, ios::out);		fileName << topologyDirectory << "/" << nodi << "/graphS" << i << "N" << nodi;				// Carica il file di topologia dalla directory di topologia.		loadFromFile(fileName.str().c_str(), graph);						for (Graph::iterator n = graph.begin(); n != graph.end(); n++) {			tmp1 = 0;			tmp2 = 0;						// Conta tutti i vicini maggiori di un nodo a seconda del			// criterio di maggioranza.			for (NodeList::iterator nn = n->second.begin(); nn != n->second.end(); nn++) {				if ((*nn) > (n->first))					tmp1++;				if ((graph[*nn].size() > n->second.size()) ||					((graph[*nn].size() == n->second.size()) &&					 ((*nn) > n->first)))					tmp2++;			}			degree_id[tmp1]++;			degree_degree[tmp2]++;			degree_altro[tmp2 - tmp1]++;		}	}}

⌨️ 快捷键说明

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