本文整理汇总了C++中PNEANet::AttrValueNI方法的典型用法代码示例。如果您正苦于以下问题:C++ PNEANet::AttrValueNI方法的具体用法?C++ PNEANet::AttrValueNI怎么用?C++ PNEANet::AttrValueNI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNEANet
的用法示例。
在下文中一共展示了PNEANet::AttrValueNI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ManipulateNodeEdgeAttributes
//.........这里部分代码省略.........
NodeId++;
}
}
// Test vertical iterator over many types (must skip default/deleted attr)
int NId = 55;
Graph->AddStrAttrDatN(NId, "aaa", attr1);
Graph->AddIntAttrDatN(NId, 3*2, attr2);
Graph->AddFltAttrDatN(NId, 3.41, attr3);
Graph->AddStrAttrDatN(80, "dont appear", attr4); // should not show up
TStrV NIdAttrName;
Graph->AttrNameNI(NId, NIdAttrName);
int AttrLen = NIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Node: %i, Attr: %s\n", NId, NIdAttrName[i]());
}
Graph->DelAttrDatN(NId, attr2);
Graph->AttrNameNI(NId, NIdAttrName);
AttrLen = NIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Node (no int) : %i, Attr: %s\n", NId, NIdAttrName[i]());
}
Graph->AddIntAttrDatN(NId, 3*2, attr2);
Graph->DelAttrN(attr1);
Graph->AttrNameNI(NId, NIdAttrName);
AttrLen = NIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Node (no str) : %i, Attr: %s\n", NId, NIdAttrName[i]());
}
TStrV NIdAttrValue;
Graph->AttrValueNI(NId, NIdAttrValue);
AttrLen = NIdAttrValue.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Node (no str) : %i, Attr_Val: %s\n", NId, NIdAttrValue[i]());
}
for (i = 0; i <NNodes; i++) {
Graph->AddIntAttrDatN(i, 70, attr2);
}
{
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();
}
printf("Average: %i (should be 70)\n", total/NNodes);
Graph1->Clr();
// Test vertical int iterator for edge
Graph->AddIntAttrDatE(3, 3*2, attr2);
示例2: FOut
//.........这里部分代码省略.........
Graph->AddFltAttrDatN(NId, 3.41, attr3);
Graph->AddStrAttrDatN(80, "dont appear", attr4); // should not show up
TStrV NIdAttrName;
Graph->AttrNameNI(NId, NIdAttrName);
int AttrLen = NIdAttrName.Len();
NodeId = 0;
DefNodes = 0;
EXPECT_EQ(3, AttrLen);
Graph->DelAttrDatN(NId, attr2);
Graph->AttrNameNI(NId, NIdAttrName);
AttrLen = NIdAttrName.Len();
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();
}