本文整理汇总了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"));
}
}
示例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;
}
示例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());
}