本文整理汇总了C++中TFltPrV::EndI方法的典型用法代码示例。如果您正苦于以下问题:C++ TFltPrV::EndI方法的具体用法?C++ TFltPrV::EndI怎么用?C++ TFltPrV::EndI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFltPrV
的用法示例。
在下文中一共展示了TFltPrV::EndI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TriadGetTestTUNGraph
// Test GetClustCf (Distribution and Closed and Open)
TEST(triad, TestGetClustCfDistCO) {
const int ExpClosedTr = 3; // Expected closed triads
const int ExpOpenTr = 9; // Expected open triads
// Test TUNGraph
PUNGraph GraphTUN = TriadGetTestTUNGraph();
TFltPrV DegToCCfV;
int64 ClosedTr = 0;
int64 OpenTr = 0;
TSnap::GetClustCf(GraphTUN, DegToCCfV, ClosedTr, OpenTr);
TestDegToCCfVector(DegToCCfV);
EXPECT_EQ(ExpClosedTr, ClosedTr);
EXPECT_EQ(ExpOpenTr, OpenTr);
// TNGraph should be treated as TUNGraph for calculations
PNGraph GraphTN = TriadGetTestTNGraph();
DegToCCfV.Clr();
ClosedTr = 0;
OpenTr = 0;
TSnap::GetClustCf(GraphTN, DegToCCfV, ClosedTr, OpenTr);
TestDegToCCfVector(DegToCCfV);
EXPECT_EQ(ExpClosedTr, ClosedTr);
EXPECT_EQ(ExpOpenTr, OpenTr);
// TNEGraph is not treated the same! Be careful with multigraphs
PNEGraph GraphTNE = TriadGetTestTNEGraph();
DegToCCfV.Clr();
ClosedTr = 0;
OpenTr = 0;
TSnap::GetClustCf(GraphTNE, DegToCCfV, ClosedTr, OpenTr);
for (TFltPr *Pair = DegToCCfV.BegI(); Pair < DegToCCfV.EndI(); Pair++) {
double Diff = Pair->Val2 - 5.0/9.0; // Used for case 4
Diff = (Diff < 0) ? -1.0*Diff : Diff; // Used for case 4
switch ((int) Pair->Val1) {
case 2:
EXPECT_EQ(1.0, Pair->Val2);
break;
case 4:
EXPECT_GT(0.00001, Diff); // Due to floats being imprecise
break;
case 7:
EXPECT_EQ(2.0/3.0, Pair->Val2);
break;
case 15:
EXPECT_EQ(0.3, Pair->Val2);
break;
default:
ASSERT_FALSE(true); // Shouldn't have degrees other than listed
break;
}
}
EXPECT_EQ(ExpClosedTr, ClosedTr);
EXPECT_EQ(ExpOpenTr, OpenTr);
}
示例2: TriadGetTestTUNGraph
// Test GetClustCf (Distribution and Closed and Open)
TEST(triad, TestGetClustCfDistCO) {
const int expected_closed = 3; // Expected closed triads
const int expected_open = 9; // Expected open triads
// Test TUNGraph
PUNGraph Graph_TUNGraph = TriadGetTestTUNGraph();
TFltPrV DegToCCfV;
int64 closed = 0, open = 0;
TSnap::GetClustCf(Graph_TUNGraph, DegToCCfV, closed, open);
TestDegToCCfVector(DegToCCfV);
EXPECT_EQ(expected_closed, closed);
EXPECT_EQ(expected_open, open);
// TNGraph should be treated as TUNGraph for calculations
PNGraph Graph_TNGraph = TriadGetTestTNGraph();
DegToCCfV.Clr();
closed = 0, open = 0;
TSnap::GetClustCf(Graph_TNGraph, DegToCCfV, closed, open);
TestDegToCCfVector(DegToCCfV);
EXPECT_EQ(expected_closed, closed);
EXPECT_EQ(expected_open, open);
// TNEGraph is not treated the same! Be careful with multigraphs
PNEGraph Graph_TNEGraph = TriadGetTestTNEGraph();
DegToCCfV.Clr();
closed = 0, open = 0;
TSnap::GetClustCf(Graph_TNEGraph, DegToCCfV, closed, open);
for (TFltPr *pair = DegToCCfV.BegI(); pair < DegToCCfV.EndI(); pair++) {
double diff = pair->Val2 - 5.0/9.0; // Used for case 4
diff = (diff < 0) ? -1.0*diff : diff; // Used for case 4
switch ((int) pair->Val1) {
case 2:
EXPECT_EQ(1.0, pair->Val2);
break;
case 4:
EXPECT_GT(0.00001, diff); // Due to floats being imprecise
break;
case 7:
EXPECT_EQ(2.0/3.0, pair->Val2);
break;
case 15:
EXPECT_EQ(0.3, pair->Val2);
break;
default:
ASSERT_FALSE(true); // Shouldn't have degrees other than listed
break;
}
}
EXPECT_EQ(expected_closed, closed);
EXPECT_EQ(expected_open, open);
}
示例3: TestDegToCCfVector
// Helper: Testing Degree to Clustering Coefficient Distribution
void TestDegToCCfVector(TFltPrV& DegToCCfV) {
for (TFltPr *Pair = DegToCCfV.BegI(); Pair < DegToCCfV.EndI(); Pair++) {
switch ((int) Pair->Val1) {
case 1:
EXPECT_EQ(0.0, Pair->Val2);
break;
case 2:
EXPECT_EQ(1.0, Pair->Val2);
break;
case 3:
EXPECT_EQ(2.0/3.0, Pair->Val2);
break;
case 5:
EXPECT_EQ(0.3, Pair->Val2);
break;
default:
ASSERT_FALSE(true); // Shouldn't have degrees other than listed
break;
}
}
}