本文整理汇总了C++中ProgramState::clustering方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramState::clustering方法的具体用法?C++ ProgramState::clustering怎么用?C++ ProgramState::clustering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgramState
的用法示例。
在下文中一共展示了ProgramState::clustering方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//}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);
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();