本文整理汇总了C++中PNEANet::DelAttrE方法的典型用法代码示例。如果您正苦于以下问题:C++ PNEANet::DelAttrE方法的具体用法?C++ PNEANet::DelAttrE怎么用?C++ PNEANet::DelAttrE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNEANet
的用法示例。
在下文中一共展示了PNEANet::DelAttrE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ManipulateNodeEdgeAttributes
//.........这里部分代码省略.........
if (EI.GetDat() != TInt::Mn) {
printf("E Attribute: %s, Edge: %i, Val: %i\n", attr2(), EdgeId, EI.GetDat()());
EdgeId++;
}
}
// Test vertical flt iterator for edge
Graph->AddFltAttrE(attr3, 0.00);
Graph->AddFltAttrDatE(5, 4.41, attr3);
Graph->AddFltAttrDatE(50, 3.718, attr3);
Graph->AddFltAttrDatE(300, 151.0, attr3);
Graph->AddFltAttrDatE(653, 654, attr3);
EdgeId = 0;
for (TNEANet::TAFltI EI = Graph->BegEAFltI(attr3);
EI < Graph->EndEAFltI(attr3); EI++) {
// Check if defaults are set to 0.
if (EI.GetDat() != 0.00) {
printf("E Attribute: %s, Edge: %i, Val: %f\n", attr3(), EdgeId, EI.GetDat()());
EdgeId++;
}
}
// Test vertical str iterator for edge
Graph->AddStrAttrDatE(10, "abc", attr1);
Graph->AddStrAttrDatE(20, "def", attr1);
Graph->AddStrAttrDatE(400, "ghi", attr1);
// this does not show since ""=null
Graph->AddStrAttrDatE(455, "", attr1);
EdgeId = 0;
for (TNEANet::TAStrI EI = Graph->BegEAStrI(attr1);
EI < Graph->EndEAStrI(attr1); EI++) {
if (EI.GetDat() != TStr::GetNullStr()) {
printf("E Attribute: %s, Edge: %i, Val: %s\n", attr1(), EdgeId, EI.GetDat()());
EdgeId++;
}
}
// Test vertical iterator over many types (must skip default/deleted attr)
int EId = 55;
Graph->AddStrAttrDatE(EId, "aaa", attr1);
Graph->AddIntAttrDatE(EId, 3*2, attr2);
Graph->AddFltAttrDatE(EId, 3.41, attr3);
Graph->AddStrAttrDatE(80, "dont appear", attr4); // should not show up
TStrV EIdAttrName;
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Edge: %i, Attr: %s\n", EId, EIdAttrName[i]());
}
Graph->DelAttrDatE(EId, attr2);
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Edge (no int) : %i, Attr: %s\n", EId, EIdAttrName[i]());
}
Graph->AddIntAttrDatE(EId, 3*2, attr2);
Graph->DelAttrE(attr1);
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Edge (no str) : %i, Attr: %s\n", EId, EIdAttrName[i]());
}
TStrV EIdAttrValue;
Graph->AttrValueEI(EId, EIdAttrValue);
AttrLen = EIdAttrValue.Len();
for (int i = 0; i < AttrLen; i++) {
printf("Vertical Edge (no str) : %i, Attr_Val: %s\n", EId, EIdAttrValue[i]());
}
for (i = 0; i <NEdges; i++) {
Graph->AddIntAttrDatE(i, 70, attr2);
}
{
TFOut FOut(FName);
Graph->Save(FOut);
FOut.Flush();
Graph->Clr();
}
{
TFIn FIn(FName);
Graph1 = TNEANet::Load(FIn);
}
total = 0;
for (TNEANet::TAIntI EI = Graph1->BegNAIntI(attr2);
EI < Graph1->EndNAIntI(attr2); EI++) {
total += EI.GetDat();
}
printf("Average: %i (should be 70)\n", total/NEdges);
//Graph1->Dump();
Graph1->Clr();
}
示例2: FOut
//.........这里部分代码省略.........
Graph->AddStrAttrDatE(455, "", attr1);
EXPECT_EQ('c', Graph->GetEAStrI(attr1, 10).GetDat().LastCh());
EXPECT_EQ('f', Graph->GetEAStrI(attr1, 20).GetDat().LastCh());
EdgeId = 0;
DefEdges = 0;
TAStrIV.Clr();
for (TNEANet::TAStrI EI = Graph->BegEAStrI(attr1);
EI < Graph->EndEAStrI(attr1); EI++) {
if (EI.GetDat() != TStr::GetNullStr()) {
TAStrIV.Add(EI.GetDat());
EdgeId++;
} else {
DefEdges++;
}
}
EXPECT_EQ(3, EdgeId);
EXPECT_EQ(NEdges - 3, DefEdges);
TAStrIV.Sort();
// TODO(nkhadke): Fix hack to compare strings properly. This works for now.
EXPECT_EQ('c', TAStrIV[0].LastCh());
EXPECT_EQ('f', TAStrIV[1].LastCh());
EXPECT_EQ('i', TAStrIV[2].LastCh());
// Test vertical iterator over many types (must skip default/deleted attr)
int EId = 55;
Graph->AddStrAttrDatE(EId, "aaa", attr1);
Graph->AddIntAttrDatE(EId, 3*2, attr2);
Graph->AddFltAttrDatE(EId, 3.41, attr3);
Graph->AddStrAttrDatE(80, "dont appear", attr4); // should not show up
TStrV EIdAttrName;
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
EXPECT_EQ(3, AttrLen);
Graph->DelAttrDatE(EId, attr2);
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
for (i = 0; i < AttrLen; i++) {
if (TStr("int") == EIdAttrName[i]()) {
// FAIL
EXPECT_EQ(2,3);
}
}
Graph->AddIntAttrDatE(EId, 3*2, attr2);
Graph->DelAttrE(attr1);
Graph->AttrNameEI(EId, EIdAttrName);
AttrLen = EIdAttrName.Len();
for (i = 0; i < AttrLen; i++) {
if (TStr("aaa") == EIdAttrName[i]()) {
// FAIL
EXPECT_EQ(2,3);
}
}
TStrV EIdAttrValue;
Graph->AttrValueEI(EId, EIdAttrValue);
AttrLen = EIdAttrValue.Len();
for (i = 0; i < AttrLen; i++) {
if (TStr("str") == EIdAttrValue[i]()) {
// FAIL
EXPECT_EQ(2,3);
}
}
expectedTotal = 0;
for (i = 0; i <NEdges; i++) {
Graph->AddIntAttrDatE(i, NEdges+i, attr2);
EXPECT_EQ(NEdges+i, Graph->GetIntAttrDatE(i, attr2));
expectedTotal += NEdges+i;
}
{
TFOut FOut(FName);
Graph->Save(FOut);
FOut.Flush();
Graph->Clr();
}
{
TFIn FIn(FName);
Graph1 = TNEANet::Load(FIn);
}
total = 0;
for (TNEANet::TAIntI EI = Graph1->BegNAIntI(attr2);
EI < Graph1->EndNAIntI(attr2); EI++) {
total += EI.GetDat();
}
EXPECT_EQ(expectedTotal, total);
//Graph1->Dump();
Graph1->Clr();
}