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


C++ edge类代码示例

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


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

示例1: OGDF_ASSERT

face CombinatorialEmbedding::joinFacesPure(edge e)
{
	OGDF_ASSERT(e->graphOf() == m_pGraph);

	// get the two faces adjacent to e
	face f1 = m_rightFace[e->adjSource()];
	face f2 = m_rightFace[e->adjTarget()];

	OGDF_ASSERT(f1 != f2);

	// we will reuse the largest face and delete the other one
	if (f2->m_size > f1->m_size)
		swap(f1,f2);

	// the size of the joined face is the sum of the sizes of the two faces
	// f1 and f2 minus the two adjacency entries of e
	f1->m_size += f2->m_size - 2;

	// If the stored (first) adjacency entry of f1 belongs to e, we must set
	// it to the next entry in the face, because we will remove it by deleting
	// edge e
	if (f1->entries.m_adjFirst->theEdge() == e)
		f1->entries.m_adjFirst = f1->entries.m_adjFirst->faceCycleSucc();

	// each adjacency entry in f2 belongs now to f1
	adjEntry adj1 = f2->firstAdj(), adj = adj1;
	do {
		m_rightFace[adj] = f1;
	} while((adj = adj->faceCycleSucc()) != adj1);

	faces.del(f2);

	return f1;
}
开发者ID:lncosie,项目名称:ogdf,代码行数:34,代码来源:CombinatorialEmbedding.cpp

示例2:

	edge VarEdgeInserterDynCore::ExpandedGraph::insertEdge(node vG, node wG, edge eG)
	{
		node &rVG = m_GtoExp[vG];
		node &rWG = m_GtoExp[wG];

		if (rVG == nullptr) {
			rVG = m_exp.newNode();
			m_nodesG.pushBack(vG);
		}
		if (rWG == nullptr) {
			rWG = m_exp.newNode();
			m_nodesG.pushBack(wG);
		}

		edge e1 = m_exp.newEdge(rVG, rWG);

		if (eG != nullptr) {
			m_expToG[e1->adjSource()] = eG->adjSource();
			m_expToG[e1->adjTarget()] = eG->adjTarget();
		}
		else {
			m_expToG[e1->adjSource()] = nullptr;
			m_expToG[e1->adjTarget()] = nullptr;
		}

		return e1;
	}
开发者ID:lncosie,项目名称:ogdf,代码行数:27,代码来源:VarEdgeInserterDynCore.cpp

示例3: getedges

//==============================================================================================
void triangle::getedges(edge &e1,edge &e2,edge &e3)
{
	e1.setedgeparams(x1,y1,x2,y2,pointids[0],pointids[1]);	
	e2.setedgeparams(x2,y2,x3,y3,pointids[1],pointids[2]);	
	e3.setedgeparams(x3,y3,x1,y1,pointids[2],pointids[0]);

}
开发者ID:hsitaram,项目名称:triangulation,代码行数:8,代码来源:triangle.cpp

示例4:

edge ExpandedGraph2::insertEdge(node vG, node wG, edge eG)
{
    node &rVG = m_GtoExp[vG];
    node &rWG = m_GtoExp[wG];

    if (rVG == 0) {
        rVG = m_exp.newNode();
        m_nodesG.pushBack(vG);
    }
    if (rWG == 0) {
        rWG = m_exp.newNode();
        m_nodesG.pushBack(wG);
    }

    edge e1 = m_exp.newEdge(rVG,rWG);

    if(eG != 0) {
        m_expToG[e1->adjSource()] = eG->adjSource();
        m_expToG[e1->adjTarget()] = eG->adjTarget();
    } else {
        m_expToG[e1->adjSource()] = 0;
        m_expToG[e1->adjTarget()] = 0;
    }

    return e1;
}
开发者ID:kdbanman,项目名称:browseRDF,代码行数:26,代码来源:VariableEmbeddingInserter2.cpp

示例5: forall_edges

	// Add additional edges between nodes and clusters to reflect adjacency hierarchy also
	// with respect to clusters
	forall_edges(e, G) {
		node u = e->source();
		node v = e->target();

		// e was reversed?
		if(m_copyEdge[e].front()->source() != m_copy[e->source()])
			swap(u,v);

		if(CG.clusterOf(u) != CG.clusterOf(v)) {
			cluster c = lca(u, v);
			cluster cTo, cFrom;

			if(m_secondPathTo == v) {
				cTo   = m_secondPath;
				cFrom = m_mark[c];
			} else {
				cFrom = m_secondPath;
				cTo   = m_mark[c];
			}

			// Transfer adjacency relationship to a relationship between clusters
			// "clusters shall be above each other"
			edge eH = 0;
			if(cFrom != c && cTo != c)
				eH = addEdge(m_bottomNode[cFrom], m_topNode[cTo]);

			// if this is not possible, try to relax it to a relationship between node and cluster
			if(eH == 0) {
				addEdge(m_copy[u], m_topNode[cTo]);
				addEdge(m_bottomNode[cFrom], m_copy[v]);
			}
		}
	}
开发者ID:mneumann,项目名称:tulip,代码行数:35,代码来源:sugiyama-cluster.cpp

示例6: contract

node CombinatorialEmbedding::contract(edge e)
{
	// Since we remove face e, we also remove adjSrc and adjTgt.
	// We make sure that node of them is stored as first adjacency
	// entry of a face.
	adjEntry adjSrc = e->adjSource();
	adjEntry adjTgt = e->adjTarget();

	face fSrc = m_rightFace[adjSrc];
	face fTgt = m_rightFace[adjTgt];

	if (fSrc->entries.m_adjFirst == adjSrc) {
		adjEntry adj = adjSrc->faceCycleSucc();
		fSrc->entries.m_adjFirst = (adj != adjTgt) ? adj : adj->faceCycleSucc();
	}

	if (fTgt->entries.m_adjFirst == adjTgt) {
		adjEntry adj = adjTgt->faceCycleSucc();
		fTgt->entries.m_adjFirst = (adj != adjSrc) ? adj : adj->faceCycleSucc();
	}

	node v = m_pGraph->contract(e);
	--fSrc->m_size;
	--fTgt->m_size;

	OGDF_ASSERT_IF(dlConsistencyChecks, consistencyCheck());

	return v;
}
开发者ID:lncosie,项目名称:ogdf,代码行数:29,代码来源:CombinatorialEmbedding.cpp

示例7: forall_edges

	forall_edges (e, G)
	{
		if (e.source() != e.target())
		{
			edge ec = g.new_edge (partner[e.source()], partner[e.target()]);
			w[ec] = edge_weight[e];
		}
	}
开发者ID:rdmpage,项目名称:bioguid,代码行数:8,代码来源:mincut.cpp

示例8: connect

// connects the a.dst to b.org through a new edge
edge connect(edge a, edge b) {
    Edge_Record er = make_edge();
    er.get_qr().v = a.dst();
    er.sym().get_qr().v = b.org();
    splice(er, a.lnext());
    splice(er.sym(), b);
    return er;
}
开发者ID:axiao,项目名称:delaunay,代码行数:9,代码来源:quadedge.cpp

示例9: relaxEdge

void TopologicSSSP::relaxEdge(int sourceComponent, int targetComponent, edge e) {
	if( m_componentDistanceArray[sourceComponent] + e->getWeight() < 
		m_componentDistanceArray[targetComponent]) {
			
			m_componentDistanceArray[targetComponent] = m_componentDistanceArray[sourceComponent] + e->getWeight();
			m_componentPredsArray[targetComponent] = e->getSource();
			m_componentBestArray[targetComponent] = e->getTarget();
	}
}
开发者ID:anaesthetic,项目名称:Goldberg,代码行数:9,代码来源:Topologic.cpp

示例10: print_edge

void print_edge(edge e, string delim)
{

  int a = e->source()->index(), b = e->target()->index(), t;
  if (a > b) 
    SWAP(a, b, t);
  
  printf("%s%d %d", delim.c_str(), a, b);
}
开发者ID:peskoj,项目名称:SurfaceEmbedder,代码行数:9,代码来源:ogdfbase.cpp

示例11: print_edge_string

string print_edge_string(edge e)
{

  int a = e->source()->index(), b = e->target()->index(), t;
  if (a > b) 
    SWAP(a, b, t);
  
  sprintf(buf, "%d %d", a, b);
  
  string res = buf;
  return res;
}
开发者ID:peskoj,项目名称:SurfaceEmbedder,代码行数:12,代码来源:ogdfbase.cpp

示例12: intersect

	// tests if two edges cross
	bool Planarity::intersect(const edge e1, const edge e2) const
	{
		node v1s = e1->source();
		node v1t = e1->target();
		node v2s = e2->source();
		node v2t = e2->target();

		bool cross = false;
		if(v1s != v2s && v1s != v2t && v1t != v2s && v1t != v2t)
			cross = lowLevelIntersect(currentPos(v1s),currentPos(v1t),
									  currentPos(v2s),currentPos(v2t));
		return cross;
	}
开发者ID:SiteView,项目名称:NNMQT,代码行数:14,代码来源:Planarity.cpp

示例13: updateMerger

//update face information after inserting a merger ith edge e in a copy graph
void CombinatorialEmbedding::updateMerger(edge e, face fRight, face fLeft)
{
	//two cases: a single face/two faces
	fRight->m_size++;
	fLeft->m_size++;
	m_rightFace[e->adjSource()] = fRight;
	m_rightFace[e->adjTarget()] = fLeft;
	//check for first adjacency entry
	if (fRight != fLeft)
	{
		fRight->entries.m_adjFirst = e->adjSource();
		fLeft->entries.m_adjFirst = e->adjTarget();
	}//if
}//updateMerger
开发者ID:lncosie,项目名称:ogdf,代码行数:15,代码来源:CombinatorialEmbedding.cpp

示例14: deleteEdge

bool MultilevelGraph::deleteEdge(NodeMerge * NM, edge theEdge)
{
	int index = theEdge->index();

	NM->m_deletedEdges.push_back(index);
	NM->m_doubleWeight[index] = m_weight[theEdge];
	NM->m_source[index] = theEdge->source()->index();
	NM->m_target[index] = theEdge->target()->index();

	m_G->delEdge(theEdge);
	m_reverseEdgeIndex[index] = nullptr;

	return true;
}
开发者ID:ogdf,项目名称:ogdf,代码行数:14,代码来源:MultilevelGraph.cpp

示例15: split

edge PlanRep::split(edge e)
{
	bool cageBound = (m_expandedNode[e->source()] && m_expandedNode[e->target()])
		&& (m_expandedNode[e->source()] == m_expandedNode[e->target()]);
	node expNode = (cageBound ? m_expandedNode[e->source()] : nullptr);

	edge eNew = GraphCopy::split(e);
	m_eType[eNew] = m_eType[e];
	m_edgeTypes[eNew] = m_edgeTypes[e];
	m_expansionEdge[eNew] = m_expansionEdge[e];

	m_expandedNode[eNew->source()] = expNode;

	return eNew;
}
开发者ID:lncosie,项目名称:ogdf,代码行数:15,代码来源:PlanRep.cpp


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