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


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

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


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

示例1: main


//.........這裏部分代碼省略.........
			std::list<int> ret = state->maxCliqueExact(max_time);
			
			if(!ret.empty()) {
				cout << "Max clique size is: " + to_string(ret.size()) + ".\n";
				cout << "Max clique is: ";
				for(std::list<int>::iterator iterator = ret.begin();iterator != ret.end();iterator++){
		        	cout << to_string<int>(*iterator).c_str() << " ";
		        }
		        cout << ".\n";
			} else {
				errorMessage("Time out.");
				ERROR_EXIT;
			}
		} else if (args_info->maxCliqueAprox_given) {
			std::list<int> ret = state->maxCliqueAprox();
			if(!ret.empty()) {
				cout << "Max clique size is: " + to_string(ret.size()) + ".\n";
				cout << "Max clique is:";
				for(std::list<int>::iterator iterator = ret.begin();iterator != ret.end();iterator++){
		        	cout << " " << to_string<int>(*iterator).c_str() ;
		        }
		        cout << ".\n";
			} else {
				errorMessage("Unknown error.");
			}
		}else if (args_info->shell_given) {
			int vertex_id = args_info->shell_arg;
			double ret = state->shellIndex(vertex_id);
			if(ret != -1) {
				cout << "Shell index for vertex " + to_string(vertex_id) + " is: " + to_string(ret) + ".\n";
			} else {
				errorMessage("Invalid vertex id");
			}
		}
		
		if (args_info->print_deg_given) {
		    if (args_info->erdos_given || args_info->barabasi_given || args_info->hot_given || args_info->molloy_given || args_info->hyperbolic_given
			|| args_info->input_file_given) {
			    state->printDegrees();
			} else {
			    usageErrorMessage("You have specified the print-deg options but no graph was loaded or generated. Ignoring.");
			}
		    
		}

		if (args_info->output_file_given) {
			string path = args_info->output_file_arg;

			if (args_info->betweenness_output_given || args_info->ddist_output_given || 
					args_info->clustering_output_given || args_info->maxCliqueExact_output_given || 
					args_info->maxCliqueAprox_output_given || args_info->knn_output_given || 
					args_info->shell_output_given) {
				string functionMessage = "";

				if (args_info->betweenness_output_given) {
					//if (state->isWeighted()) {
					//	errorMessage("Betweenness for weighted graphs is not supported.");
					//	ERROR_EXIT;
					//} else {
						state->exportBetweennessVsDegree(path);
						functionMessage = "betweenness";
					//}
				} else if (args_info->ddist_output_given) {
					state->exportDegreeDistribution(path, args_info->log_bin_given, args_info->log_bin_arg);
					functionMessage = "degreeDistribution";
				} else if (args_info->clustering_output_given) {
					state->exportClusteringVsDegree(path);
					functionMessage = "clustering coefficient";
				} else if (args_info->knn_output_given) {
					state->exportNearestNeighborsDegreeVsDegree(path);
					functionMessage = "nearest neighbors degree";
				} else if (args_info->shell_output_given) {
					if (state->isWeighted()) {
						errorMessage("Shell index for weighted graphs is not supported.");
						ERROR_EXIT;
					} else {
						state->exportShellIndexVsDegree(path);
						functionMessage = "shellIndex";
					}
				} if (args_info->maxCliqueExact_output_given) {
					int max_time = args_info->maxCliqueExact_output_arg;
					if(!state->exportMaxCliqueExact(path, max_time)) {
						errorMessage("Time out.");
						ERROR_EXIT;
					}
					functionMessage = "max clique distribution";
				} else if (args_info->maxCliqueAprox_output_given) {
					state->exportMaxCliqueAprox(path);
					functionMessage = "max clique distribution aproximation";
				}

				cout << "Succesfully exported " + functionMessage + " in output file " + path + ".\n";
			} else {
				state->exportCurrentGraph(path);
				cout << "Succesfully saved graph in file " + path + ".\n";
			}
		}
	}

}
開發者ID:alemedve,項目名稱:complexnets,代碼行數:101,代碼來源:main.cpp


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