当前位置: 首页>>代码示例>>C++>>正文


C++ ProgramState::betweenness方法代码示例

本文整理汇总了C++中ProgramState::betweenness方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramState::betweenness方法的具体用法?C++ ProgramState::betweenness怎么用?C++ ProgramState::betweenness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgramState的用法示例。


在下文中一共展示了ProgramState::betweenness方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
 			cout << "Succesfully created an Extended Hot graph with " + to_string(n) + " nodes.\n";

		} else if (args_info->molloy_given) {
			if (!args_info->ks_given) {
				usageErrorMessage("A file with Ks and its nodes is needed to create a Molloy Reed graph.");
				ERROR_EXIT;
			}

			string path = args_info->ks_arg;
			state->setMolloyReedGraph(path);
		} else if (args_info->hyperbolic_given) {
			if (!args_info->n_given) {
				usageErrorMessage("Hiperbolic graph generation requires a number of nodes.");
				ERROR_EXIT;
			}
			if (!args_info->a_given) {
				usageErrorMessage("Hiperbolic graph generation requires a radial density.");
				ERROR_EXIT;
			}
			if (!args_info->deg_given) {
				usageErrorMessage("Hiperbolic graph generation requires an average node degree.");
				ERROR_EXIT;
			}
			int n = args_info->n_arg;
			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";
开发者ID:alemedve,项目名称:complexnets,代码行数:67,代码来源:main.cpp


注:本文中的ProgramState::betweenness方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。