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


C++ Network::NModule方法代码示例

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


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

示例1: print_twoLevel_Cluster

void print_twoLevel_Cluster(Network network, string networkName, string outDir) {
	ofstream outFile;
	ostringstream oss;
	oss << outDir << "/" << networkName << ".tree";
	outFile.open(oss.str().c_str());

	outFile << "# Code length " << network.CodeLength()/log(2.0) << " in " << network.NModule() << " modules." << endl;

	int nModules = network.modules.size();
	int modIdx = 0;
	for (int i = 0; i < nModules; i++) {

		int nMembers = network.modules[i].NumMembers();
		if (nMembers > 0)
			modIdx++;

		for (int j = 0; j < nMembers; j++) {
			outFile << modIdx << ":" << j+1 << " " << network.modules[i].members[j]->Size() << " \"" << network.modules[i].members[j]->Name() << "\"" << endl;
		}
	}

	outFile.close();
}
开发者ID:uwescience,项目名称:RelaxMap,代码行数:23,代码来源:OmpRelaxmap.cpp

示例2: main


//.........这里部分代码省略.........
		}   
	}
  

    if(includeSelfLinks)
		//cout << "including " <<  NselfLinks << " self link(s)." << endl;  
		cout << "current version always excludes self links.\nignoring " << NselfLinks << " self link(s)." << endl;
    else
        cout << "ignoring " <<  NselfLinks << " self link(s)." << endl;

	//Swap vector to free memory
	map<pair<int,int>,double>().swap(origNetwork.Edges);
        
	cout << "DONE: Parsing the given network  ..." << endl;

	gettimeofday(&end, NULL);
	cout << "Time for parsing the given network : " << elapsedTimeInSec(start, end) << " (sec)" << endl;


	gettimeofday(&start, NULL);
	// Initialization.
	origNetwork.initiate(numThreads);

	// Now update inLinks..
	for (int i = 0; i < nNode; i++) {
		int nOutLinks = origNetwork.nodes[i].outLinks.size();
		for (int j = 0; j < nOutLinks; j++)
			origNetwork.nodes[origNetwork.nodes[i].outLinks[j].first].inLinks.push_back(make_pair(i,origNetwork.nodes[i].outLinks[j].second));
	}

	gettimeofday(&end, NULL);

	cout << "DONE: Initiate() ... in " << elapsedTimeInSec(start, end) << " (sec)" << endl;
	cout << "Initial Code Length: " << origNetwork.CodeLength()/log(2.0) << " in " << origNetwork.NModule() << " modules.\n";

	
	// copy size of each node for print in order.
	vector<double> nodeSize(nNode);
	for (int i = 0; i < nNode; i++)
		nodeSize[i] = origNetwork.nodes[i].Size();

	
	cout << "Now partition the network starts...\n";
	gettimeofday(&start, NULL);


	
	bool fineTune = true;
	bool fast = false;		// This will be true only for sub-module partitioning...

	int step = 1;

	// Initial SuperStep running ...
	double oldCodeLength = origNetwork.CodeLength();

	stochastic_greedy_partition(origNetwork, numThreads, threshold, vThresh, maxIter, prior, fineTune, fast);
	cout << "SuperStep [" << step << "] - codeLength = " << origNetwork.CodeLength()/log(2.0) << " in " << origNetwork.NModule() << " modules." << endl;

	bool nextIter = true;

	if ((oldCodeLength - origNetwork.CodeLength())/log(2.0) < threshold)
		nextIter = false;

	struct timeval subStart, subEnd;

	while (nextIter) {	
开发者ID:uwescience,项目名称:RelaxMap,代码行数:67,代码来源:OmpRelaxmap.cpp


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