當前位置: 首頁>>代碼示例>>C++>>正文


C++ ProgramState::inDegreeDistribution方法代碼示例

本文整理匯總了C++中ProgramState::inDegreeDistribution方法的典型用法代碼示例。如果您正苦於以下問題:C++ ProgramState::inDegreeDistribution方法的具體用法?C++ ProgramState::inDegreeDistribution怎麽用?C++ ProgramState::inDegreeDistribution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ProgramState的用法示例。


在下文中一共展示了ProgramState::inDegreeDistribution方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main


//.........這裏部分代碼省略.........
			float a = args_info->a_arg;
			float c  = args_info->deg_arg;
			state->setHiperbolicGraph(n, a, c);
			
		} else {
			usageErrorMessage("A network must be specified in order to work.");
			ERROR_EXIT;
		}
		
		if (args_info->betweenness_given) {
			//if (state->isWeighted()) {
			//	errorMessage("Betweenness for weighted graphs is not supported.");
			//	ERROR_EXIT;
			//}else{
			printf("Weighted Betweenness");
				int vertex_id = args_info->betweenness_arg;
				double ret = state->betweenness((unsigned int)args_info->betweenness_arg);
				if(ret != -1) {
					cout << "Betweenness for vertex " + to_string(vertex_id) + " is: " + to_string(ret) + ".\n";
				}else {
					errorMessage("Invalid vertex id");
				}
			//}
		} else if (args_info->ddist_given) {
			int degree = args_info->ddist_arg;
			if (!state->isDigraph()) {
				double ret = state->degreeDistribution(degree);
				if(ret != -1) {
					cout << "Degree distribution for degree " + to_string(degree) + " is: " + to_string(ret) + ".\n";
				}else {
					cout << "There are no vertices with degree " + to_string(degree) + ".\n";
				}
			} else {
				double ret1 = state->inDegreeDistribution(degree);
				double ret2 = state->outDegreeDistribution(degree);
				if(ret1 != -1) {
					cout << "In-Degree distribution for degree " + to_string(degree) + " is: " + to_string(ret1) + ".\n";
				}else {
					cout << "There are no vertices with degree " + to_string(degree) + ".\n";
				}
				if(ret2 != -1) {
					cout << "Out-Degree distribution for degree " + to_string(degree) + " is: " + to_string(ret2) + ".\n";
				}else {
					cout << "There are no vertices with degree " + to_string(degree) + ".\n";
				}
			}
		} else if (args_info->clustering_given) {
			int vertex_id = args_info->clustering_arg;
			double ret = state->clustering(vertex_id);
			if(ret != -1) {
				cout << "Clustering coefficient for vertex " + to_string(vertex_id) + " is: " + to_string(ret) + ".\n";
			} else {
				errorMessage("Invalid vertex id");
			}
		} else if (args_info->knn_given) {
			int vertex_id = args_info->knn_arg;
			double ret = state->clustering(vertex_id);
			if(ret != -1) {
				cout << "Nearest neighbors degree for vertex " + to_string(vertex_id) + " is: " + to_string(ret) + ".\n";
			} else {
				errorMessage("Invalid vertex id");
			}
		} else if (args_info->maxCliqueExact_given) {
			int max_time = args_info->maxCliqueExact_arg;
			std::list<int> ret = state->maxCliqueExact(max_time);
			
開發者ID:alemedve,項目名稱:complexnets,代碼行數:66,代碼來源:main.cpp


注:本文中的ProgramState::inDegreeDistribution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。