本文整理汇总了C++中PNEANet::GetIntAttrDatN方法的典型用法代码示例。如果您正苦于以下问题:C++ PNEANet::GetIntAttrDatN方法的具体用法?C++ PNEANet::GetIntAttrDatN怎么用?C++ PNEANet::GetIntAttrDatN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNEANet
的用法示例。
在下文中一共展示了PNEANet::GetIntAttrDatN方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StrAttr
TEST(TNEANet, AddNodeAttributeError) {
PNEANet Graph;
Graph = TNEANet::New();
TStr StrAttr("name");
TStr FltAttr("weight");
TStr IntAttr("test");
Graph->AddStrAttrN(StrAttr);
Graph->AddFltAttrN(FltAttr);
Graph->AddIntAttrN(IntAttr);
int NumNodes = 5;
for (int i = 0; i < NumNodes; i++) {
Graph->AddNode(i);
Graph->AddIntAttrDatN(i, TInt(i), IntAttr);
Graph->AddFltAttrDatN(i, TFlt(i), FltAttr);
TInt Val(i);
Graph->AddStrAttrDatN(i, Val.GetStr(), StrAttr);
}
Graph->DelNode(0);
for (int j = 1; j < NumNodes; j++) {
ASSERT_EQ(Graph->GetIntAttrDatN(j, IntAttr), j);
ASSERT_EQ(Graph->GetFltAttrDatN(j, FltAttr), TFlt(j));
TInt Val(j);
ASSERT_EQ(Graph->GetStrAttrDatN(j, StrAttr), Val.GetStr());
}
}
示例2: FOut
//.........这里部分代码省略.........
for (i = 0; i < AttrLen; i++) {
if (TStr("int") == NIdAttrName[i]()) {
// FAIL
EXPECT_EQ(1,2);
}
}
EXPECT_EQ(2, AttrLen);
Graph->AddIntAttrDatN(NId, 3*2, attr2);
Graph->DelAttrN(attr1);
Graph->AttrNameNI(NId, NIdAttrName);
AttrLen = NIdAttrName.Len();
for (i = 0; i < AttrLen; i++) {
if (TStr("str") == NIdAttrName[i]()) {
// FAIL
EXPECT_EQ(1,2);
}
}
EXPECT_EQ(2, AttrLen);
TStrV NIdAttrValue;
Graph->AttrValueNI(NId, NIdAttrValue);
AttrLen = NIdAttrValue.Len();
for (i = 0; i < AttrLen; i++) {
if (TStr("str") == NIdAttrValue[i]()) {
// FAIL
EXPECT_EQ(1,2);
}
}
int expectedTotal = 0;
for (i = 0; i <NNodes; i++) {
Graph->AddIntAttrDatN(i, NNodes+i, attr2);
EXPECT_EQ(NNodes+i, Graph->GetIntAttrDatN(i, attr2));
expectedTotal += NNodes+i;
}
{
TFOut FOut(FName);
Graph->Save(FOut);
FOut.Flush();
}
{
TFIn FIn(FName);
Graph1 = TNEANet::Load(FIn);
}
int total = 0;
for (TNEANet::TAIntI NI = Graph1->BegNAIntI(attr2);
NI < Graph1->EndNAIntI(attr2); NI++) {
total += NI.GetDat();
}
ASSERT_EQ(expectedTotal, total);
Graph1->Clr();
// Test vertical int iterator for edge
Graph->AddIntAttrDatE(3, 3*2, attr2);
Graph->AddIntAttrDatE(55, 55*2, attr2);
Graph->AddIntAttrDatE(705, 705*2, attr2);
Graph->AddIntAttrDatE(905, 905*2, attr2);
EXPECT_EQ(3*2, Graph->GetEAIntI(attr2, 3).GetDat());
EXPECT_EQ(55*2, Graph->GetEAIntI(attr2, 55).GetDat());