• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ edge类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: main

int main(int argc, char *argv[])
{
    argList::noParallel();
    argList::validArgs.append("surfaceFile");
    argList::validArgs.append("output surfaceFile");
    argList::validArgs.append("maximum length");
    argList args(argc, argv);

    const fileName surfFileName = args[1];
    const fileName outFileName = args[2];  
    const scalar maxLength = args.argRead<scalar>(3);

    Info<< "Reading surface from " << surfFileName << " ..." << endl << endl;

    const triSurface& surf1(surfFileName);
    triSurface surf2;
    triSurface surf = surf1;
    
    int loopCounter = 1;
    
    while(true)
    {
        const pointField points(surf.points());
        const labelList meshPoints(surf.meshPoints());
        const edgeList& edges = surf.edges();
        labelListList edgeFaces = surf.sortedEdgeFaces();
        
        List<bool> refineFaces(surf.size(), false);
        
        forAll(edges, i)
        {   
            const edge e = surf.edges()[i];
            const point& pStart = points[meshPoints[e.start()]];
            const point& pEnd = points[meshPoints[e.end()]];
            const vector eVec(pEnd - pStart);
            const scalar eMag = mag(eVec);
            
            if(eMag > maxLength)
            {
                labelList edgeFacesI = edgeFaces[i];
                
                forAll(edgeFacesI, i)
                {
                    label faceI = edgeFacesI[i];
                    refineFaces[faceI] = true;
                }
            }
        }
开发者ID:ahmmedshakil,项目名称:of22x,代码行数:48,代码来源:surfaceRefine.C


示例17: writeEdge

static inline bool writeEdge(
	std::ostream &out, const int &depth,
	const GraphAttributes *GA, const edge &e)
{
	GraphIO::indent(out, depth) << e->source()
	                            << (GA && !GA->directed() ? " -- " : " -> ")
	                            << e->target();

	if(GA) {
		out << " ";
		writeAttributes(out, *GA, e);
	}

	out << "\n";
	return true;
}
开发者ID:marvin2k,项目名称:ogdf,代码行数:16,代码来源:GraphIO_dot.cpp


示例18: split

edge CombinatorialEmbedding::split(edge e)
{
	face f1 = m_rightFace[e->adjSource()];
	face f2 = m_rightFace[e->adjTarget()];

	edge e2 = m_pGraph->split(e);

	m_rightFace[e->adjSource()] = m_rightFace[e2->adjSource()] = f1;
	f1->m_size++;
	m_rightFace[e->adjTarget()] = m_rightFace[e2->adjTarget()] = f2;
	f2->m_size++;

	OGDF_ASSERT_IF(dlConsistencyChecks, consistencyCheck());

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


示例19: copyEdgeTo

void MultilevelGraph::copyEdgeTo(edge e, MultilevelGraph &MLG, std::map<node, node> &tempNodeAssociations, bool associate, int index)
{
	node source = e->source();
	node target = e->target();
	edge e_new;
	if (index == -1) {
		e_new = MLG.m_G->newEdge(tempNodeAssociations[source], tempNodeAssociations[target]);
	} else {
		e_new = MLG.m_G->newEdge(tempNodeAssociations[source], tempNodeAssociations[target], index);
	}

	if(associate) {
		MLG.m_edgeAssociations[e_new] = e->index();
	}
	MLG.m_weight[e_new] = m_weight[e];
}
开发者ID:ogdf,项目名称:ogdf,代码行数:16,代码来源:MultilevelGraph.cpp


示例20: remove

	/// \{
	/// Removes an edge from the matrix.
	///
	/// Complexity: O(1)
	///
	/// \param[in] e Edge to remove
	/// \param[in] type Type of edge to add
	/// \return true on success, false otherwise
	///
	/// \note This function performs boundary check.
	bool remove(edge e, edge::type type = edge::type::uni)
	{
		if ((e.from >= n) || (e.to >= n))
			return false;
		at(e) = no_value;
		if (type == edge::type::bi)
			at(e.reverse()) = no_value;
		return true;
	}
开发者ID:mariokonrad,项目名称:graph,代码行数:19,代码来源:adjmatrix.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ edge_type类代码示例发布时间:2022-05-31
下一篇:
C++ edaMpiWorkflow类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap