本文整理匯總了C++中ProgramState::degreeDistribution方法的典型用法代碼示例。如果您正苦於以下問題:C++ ProgramState::degreeDistribution方法的具體用法?C++ ProgramState::degreeDistribution怎麽用?C++ ProgramState::degreeDistribution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProgramState
的用法示例。
在下文中一共展示了ProgramState::degreeDistribution方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
//.........這裏部分代碼省略.........
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";
}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";