本文整理汇总了C++中Pattern::addNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::addNode方法的具体用法?C++ Pattern::addNode怎么用?C++ Pattern::addNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::addNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertIntoEdgeFreq
void insertIntoEdgeFreq(NodeX* src, int destNodeID, double destNodeLabel, double edgeLabel, tr1::unordered_map<string, void* >& edgeToFreq, bool addSrcOnly)
{
string key;
if(src->getLabel()>destNodeLabel)
{
stringstream sstmGF;
if(src->getLabel()==destNodeLabel)
sstmGF << src->getLabel()<<destNodeLabel<<","<<edgeLabel<<",";
else
sstmGF << src->getLabel()<<","<<destNodeLabel<<","<<edgeLabel<<",";
key = sstmGF.str();
}
else
{
stringstream sstmGF;
if(destNodeLabel==src->getLabel())
sstmGF <<destNodeLabel<<src->getLabel()<<","<<edgeLabel<<",";
else
sstmGF <<destNodeLabel<<","<<src->getLabel()<<","<<edgeLabel<<",";
key = sstmGF.str();
}
tr1::unordered_map<string, void* >::iterator iter = edgeToFreq.find(key);
Pattern* pattern;
if(iter==edgeToFreq.end())
{
GraphX* graph = new GraphX();
NodeX* node1 = graph->AddNode(0, src->getLabel());
NodeX* node2 = graph->AddNode(1, destNodeLabel);
graph->addEdge(node1, node2, edgeLabel);
pattern = new Pattern(graph);
delete graph;
edgeToFreq[key] = pattern;
}
else
{
pattern = (Pattern*)((*iter).second);
}
if(pattern->getGraph()->getNodeWithID(0)->getLabel()==src->getLabel())
{
pattern->addNode(src->getID(), 0);
if(!addSrcOnly) pattern->addNode(destNodeID, 1);
}
else
{
pattern->addNode(src->getID(), 1);
if(!addSrcOnly) pattern->addNode(destNodeID, 0);
}
}
示例2: parseNode
void PatternParser::parseNode(QDomElement const &node, Pattern &pattern)
{
qreal const x = node.attribute("xPosition").toFloat();
qreal const y = node.attribute("yPosition").toFloat();
QString const parent = node.attribute("parent");
QPointF const pos = QPointF(x, y);
pattern.addNode(node.attribute("type"), node.attribute("name"), pos, parent);
}
示例3: parseNode
void PatternParser::parseNode(const QDomElement &node, Pattern &pattern)
{
const qreal x = node.attribute("xPosition").toFloat();
const qreal y = node.attribute("yPosition").toFloat();
const QString parent = node.attribute("parent");
const QPointF pos = QPointF(x, y);
pattern.addNode(node.attribute("type"), node.attribute("name"), pos, parent);
}