Example #1
0
UpwardPlanRep::UpwardPlanRep(const CombinatorialEmbedding &Gamma) :
	GraphCopy(Gamma.getGraph()),
	isAugmented(false),
	t_hat(nullptr),
	extFaceHandle(nullptr),
	crossings(0)
{
	OGDF_ASSERT(Gamma.externalFace() != nullptr);
	OGDF_ASSERT(hasSingleSource(*this));
	OGDF_ASSERT(isSimple(*this));

	m_isSourceArc.init(*this, false);
	m_isSinkArc.init(*this, false);
	hasSingleSource(*this, s_hat);
	m_Gamma.init(*this);

	//compute the ext. face;
	adjEntry adj;
	node v = this->original(s_hat);
	adj = getAdjEntry(Gamma, v, Gamma.externalFace());
	adj = this->copy(adj->theEdge())->adjSource();
	m_Gamma.setExternalFace(m_Gamma.rightFace(adj));

	//outputFaces(Gamma);

	computeSinkSwitches();
}
Example #2
0
// Computes combinatorial embedding of dual graph
// Precondition: CE must be combinatorial embedding of connected planar graph
DualGraph::DualGraph(CombinatorialEmbedding &CE)
{
    m_primalEmbedding = &CE;
    Graph &primalGraph = CE.getGraph();
    init(*(new Graph));
    Graph &dualGraph = getGraph();
    
    m_dualNode.init(CE);
    m_dualEdge.init(primalGraph);
    m_dualFace.init(primalGraph);
    m_primalNode.init(*this);
    m_primalFace.init(dualGraph);
    m_primalEdge.init(dualGraph);
    
    // create dual nodes
    face f;
    forall_faces(f, CE)
    {
		node vDual = dualGraph.newNode();
		m_dualNode[f] = vDual;
		m_primalFace[vDual] = f;
    }