本文整理汇总了C++中Skeleton::owner方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::owner方法的具体用法?C++ Skeleton::owner怎么用?C++ Skeleton::owner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skeleton
的用法示例。
在下文中一共展示了Skeleton::owner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createNetwork
void EmbedderOptimalFlexDraw::createNetwork(
node parent,
node mu,
int bends,
NodeArray<int> cost[],
NodeArray<long long> embedding[],
Skeleton &skeleton,
EdgeArray<node> &edgeNode,
Graph &N,
EdgeArray<int> &upper,
EdgeArray<int> &perUnitCost,
NodeArray<int> &supply)
{
Graph skeletonGraph = skeleton.getGraph();
ConstCombinatorialEmbedding skeletonEmbedding(skeletonGraph);
NodeArray<node> vertexNode(skeletonGraph);
FaceArray<node> faceNode(skeletonEmbedding);
for (node v = skeletonGraph.firstNode(); v != nullptr; v = v->succ()) {
vertexNode[v] = N.newNode();
supply[vertexNode[v]] = 4 - skeleton.original(v)->degree() - v->degree();
}
if (parent != nullptr) {
node s = skeleton.referenceEdge()->source();
node t = skeleton.referenceEdge()->target();
supply[vertexNode[s]] = 2 - s->degree();
supply[vertexNode[t]] = 2 - t->degree();
}
for (edge e = skeletonGraph.firstEdge(); e != nullptr; e = e->succ()) {
if (skeleton.isVirtual(e)) {
edgeNode[e] = N.newNode();
PertinentGraph H;
skeleton.owner().pertinentGraph(skeleton.twinTreeNode(e), H);
node s = H.original(e)->source();
node t = H.original(e)->target();
supply[edgeNode[e]] = s->degree() + t->degree() - 2;
}
}
for (face f = skeletonEmbedding.firstFace(); f != nullptr; f = f->succ()) {
faceNode[f] = N.newNode();
supply[faceNode[f]] = 4;
}
if (parent != nullptr) {
face f1 = nullptr;
face f2 = nullptr;
for (adjEntry adj : skeletonEmbedding.externalFace()->entries) {
if (adj->theEdge() == skeleton.referenceEdge()) {
f1 = skeletonEmbedding.rightFace(adj);
f2 = skeletonEmbedding.leftFace(adj);
break;
}
}
PertinentGraph H;
skeleton.owner().pertinentGraph(mu, H);
node s = skeleton.referenceEdge()->source();
node t = skeleton.referenceEdge()->target();
supply[faceNode[f1]] = H.original(s)->degree() + H.original(t)->degree() - 2 + bends;
supply[faceNode[f2]] = -bends;
} else {
supply[faceNode[skeletonEmbedding.externalFace()]] = -4;
}
for (face f = skeletonEmbedding.firstFace(); f != nullptr; f = f->succ()) {
for (adjEntry adj = f->firstAdj(); adj != nullptr; adj = adj->succ()) {
edge e1 = N.newEdge(faceNode[f], vertexNode[adj->theNode()]);
upper[e1] = 1;
perUnitCost[e1] = 0;
edge e2 = N.newEdge(vertexNode[adj->theNode()], faceNode[f]);
upper[e2] = 1;
perUnitCost[e2] = 0;
}
}
for (face f = skeletonEmbedding.firstFace(); f != nullptr; f = f->succ()) {
for (adjEntry adj = f->firstAdj(); adj != nullptr; adj = adj->succ()) {
edge e = N.newEdge(edgeNode[adj->theEdge()], faceNode[f]);
upper[e] = numeric_limits<int>::max();
perUnitCost[e] = 0;
}
}
for (face f = skeletonEmbedding.firstFace(); f != nullptr; f = f->succ()) {
for (adjEntry adj = f->firstAdj(); adj != nullptr; adj = adj->succ()) {
if (skeleton.isVirtual(adj->theEdge())) {
node mu = skeleton.twinTreeNode(adj->theEdge());
edge e0 = N.newEdge(faceNode[f], edgeNode[adj->theEdge()]);
upper[e0] = 1;
perUnitCost[e0] = cost[0][mu];
edge e1 = N.newEdge(faceNode[f], edgeNode[adj->theEdge()]);
upper[e1] = 1;
perUnitCost[e0] = cost[1][mu] - cost[0][mu];
edge e2 = N.newEdge(faceNode[f], edgeNode[adj->theEdge()]);
upper[e2] = 1;
perUnitCost[e2] = cost[2][mu] - cost[1][mu];
edge e3 = N.newEdge(faceNode[f], edgeNode[adj->theEdge()]);
upper[e3] = 1;
//.........这里部分代码省略.........