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


C++ TIntV::AddUnique方法代码示例

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


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

示例1: analyzeSimNetProps

void analyzeSimNetProps() {
	const char *eFName = "epidemicRoutingNetEdges.txt";
	const char *pFName = "prophetRoutingNetEdges.txt";

	PNGraph eGraph = TSnap::LoadEdgeListStr<PNGraph>(eFName, 0, 1);
        PNEGraph pGraph = TSnap::LoadEdgeListStr<PNEGraph>(pFName, 0, 1);
        PNGraph randGraph = TSnap::GenRndGnm<PNGraph>(eGraph->GetNodes(), eGraph->GetEdges(), true, TInt::Rnd);

	chdir("dot");

	for (int i=0; i<10; i++) {
		TIntV NIdV;
		for (int j = 0; j < 10; j++) {
			int randNode = eGraph->GetRndNId();
			NIdV.AddUnique(randNode);
		}

		// Plot the mesage propagtion in Endroy-Renyi graphs
		PNGraph randFlow = TSnap::GetSubGraph<PNGraph>(randGraph, NIdV);
		char randf[50]; sprintf(randf,"%d-erdos.dot",i);
                TSnap::SaveGViz(randFlow, randf, TStr("Edros-Renyi random graph"));

		// Now plot epidemic routing
		PNGraph epidemicFlow = TSnap::GetSubGraph<PNGraph>(eGraph, NIdV);
		char epf[50]; sprintf(epf,"%d-epidemic.dot",i);
  		TSnap::SaveGViz(epidemicFlow, epf, TStr("Epidemic routing"));
	}

}
开发者ID:evgeniyarbatov,项目名称:dev-practice,代码行数:29,代码来源:messagePropagation.cpp

示例2: GetEmailIds

TIntV GetEmailIds(const PXmlTok& QueryXml, const TStr& TagPath)
{
	TIntV EmailIdV;
	TXmlTokV Ids;
	QueryXml->GetTagTokV(TagPath, Ids);
	for (int EmlInd = 0; EmlInd < Ids.Len(); EmlInd++) 
	{
		TInt EmailIdInt = Ids[EmlInd]->GetIntArgVal("id", -1);
		if (EmailIdInt != -1)
			EmailIdV.AddUnique(EmailIdInt);
	}
	return EmailIdV;
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:13,代码来源:xmlParsing.cpp

示例3: analyzeSimNetProps

void analyzeSimNetProps(TStr messGraph, TStr netGraph) {
	// Make graphs
	PNGraph eGraph = TSnap::LoadEdgeListStr<PNGraph>(netGraph, 0, 1);
	PNGraph mGraph = TSnap::LoadEdgeListStr<PNGraph>(messGraph, 0, 1);
        PNGraph randGraph = TSnap::GenRndGnm<PNGraph>(mGraph->GetNodes(), mGraph->GetEdges(), true, TInt::Rnd);

	// Induce network graph from the entire network based on message graph
	TIntV NIdV;
	for (TNGraph::TNodeI NI = mGraph->BegNI(); NI < mGraph->EndNI(); NI++)
		NIdV.AddUnique(NI.GetId());
	PNGraph indGraph = TSnap::GetSubGraph<PNGraph>(eGraph, NIdV);

	//printf("%s:: ", messGraph.CStr()); printf("nodes %d; ", indGraph->GetNodes());
	//printf("induced edges %d, random edges %d\n", indGraph->GetEdges(), randGraph->GetEdges());
	printf("%d\t%d\t%d\n", indGraph->GetNodes(), indGraph->GetEdges(), mGraph->GetEdges());
}
开发者ID:evgeniyarbatov,项目名称:dev-practice,代码行数:16,代码来源:analyzeMessage.cpp


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