当前位置: 首页>>代码示例>>C++>>正文


C++ Skeleton::original方法代码示例

本文整理汇总了C++中Skeleton::original方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::original方法的具体用法?C++ Skeleton::original怎么用?C++ Skeleton::original使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skeleton的用法示例。


在下文中一共展示了Skeleton::original方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setPosInEmbedding

void PlanarSPQRTree::setPosInEmbedding(
	NodeArray<SListPure<adjEntry> > &adjEdges,
	NodeArray<node> &currentCopy,
	NodeArray<adjEntry> &lastAdj,
	SListPure<node> &current,
	const Skeleton &S,
	adjEntry adj)
{
	node vT = S.treeNode();

	adjEdges[vT].pushBack(adj);

	node vCopy = adj->theNode();
	node vOrig = S.original(vCopy);

	if(currentCopy[vT] == nullptr) {
		currentCopy[vT] = vCopy;
		current.pushBack(vT);

		for (adjEntry adjVirt : vCopy->adjEdges) {
			edge eCopy = S.twinEdge(adjVirt->theEdge());
			if (eCopy == nullptr) continue;
			if (adjVirt == adj) {
				lastAdj[vT] = adj;
				continue;
			}

			const Skeleton &STwin = skeleton(S.twinTreeNode(adjVirt->theEdge()));

			adjEntry adjCopy = (STwin.original(eCopy->source()) == vOrig) ?
				eCopy->adjSource() : eCopy->adjTarget();

			setPosInEmbedding(adjEdges,currentCopy,lastAdj,current,
				STwin, adjCopy);
		}

	} else if (lastAdj[vT] != nullptr && lastAdj[vT] != adj) {
		adjEntry adjVirt = lastAdj[vT];
		edge eCopy = S.twinEdge(adjVirt->theEdge());

		const Skeleton &STwin = skeleton(S.twinTreeNode(adjVirt->theEdge()));

		adjEntry adjCopy = (STwin.original(eCopy->source()) == vOrig) ?
			eCopy->adjSource() : eCopy->adjTarget();

		setPosInEmbedding(adjEdges,currentCopy,lastAdj,current,
			STwin, adjCopy);

		lastAdj[vT] = nullptr;
	}

}
开发者ID:lncosie,项目名称:ogdf,代码行数:52,代码来源:PlanarSPQRTree.cpp

示例2: 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;
//.........这里部分代码省略.........
开发者ID:lncosie,项目名称:ogdf,代码行数:101,代码来源:EmbedderOptimalFlexDraw.cpp


注:本文中的Skeleton::original方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。