void CPlanarSubClusteredST::call(const ClusterGraph &CG, EdgeArray<bool>& inST)
{
    initialize(CG);
    inST.fill(false);

    //representationsgraphs for every cluster, on clustergraph
    ClusterArray<Graph*> l_clusterRepGraph(CG, 0);
    computeRepresentationGraphs(CG, l_clusterRepGraph);

    //now we compute the spanning trees on the representation graphs
    //we should save the selection info on the original edge
    //are statically on the repgraphedges (we only have edge -> repedge
    //information) but
    ClusterArray< EdgeArray<bool> > l_inTree(CG);

    cluster c;
    forall_clusters(c, CG)
    {
        l_inTree[c].init(*l_clusterRepGraph[c], false);
        //compute STs
        NodeArray<bool> visited(*l_clusterRepGraph[c], false);
        dfsBuildSpanningTree(l_clusterRepGraph[c]->firstNode(),
                             l_inTree[c],
                             visited);
    }//forallclusters
Example #2
0
void CPlanarSubClusteredST::call(const ClusterGraph &CG, EdgeArray<bool>& inST)
{
	initialize(CG);
	inST.fill(false);

	//representationsgraphs for every cluster, on clustergraph
	ClusterArray<Graph*> l_clusterRepGraph(CG, nullptr);
	computeRepresentationGraphs(CG, l_clusterRepGraph);

	//now we compute the spanning trees on the representation graphs
	//we should save the selection info on the original edge
	//are statically on the repgraphedges (we only have edge -> repedge
	//information) but
	ClusterArray< EdgeArray<bool> > l_inTree(CG);

	for(cluster c : CG.clusters) {
		l_inTree[c].init(*l_clusterRepGraph[c], false);
		//compute STs
		NodeArray<bool> visited(*l_clusterRepGraph[c], false);
		dfsBuildSpanningTree(l_clusterRepGraph[c]->firstNode(), l_inTree[c], visited);
	}

	OGDF_ASSERT(isConnected(CG.constGraph()));

	//compute the subclustered graph by constructing a spanning tree
	//using only the representation edges used in STs on the repgraphs
	NodeArray<bool> visited(CG, false);

	dfsBuildOriginalST(CG.constGraph().firstNode(),
	                   l_inTree,
	                   inST,
	                   visited);

	//unregister the edgearrays to avoid destructor failure after
	//representation graph deletion
	for(cluster c : CG.clusters) {
		l_inTree[c].init();
	}

	deleteRepresentationGraphs(CG, l_clusterRepGraph);
}
Example #3
0
void CPlanarSubClusteredST::call(const ClusterGraph& CG,
		EdgeArray<bool>& inST,
		EdgeArray<double>& weight)
{
	initialize(CG);

	//representationsgraphs for every cluster, on clustergraph
	ClusterArray<Graph*> l_clusterRepGraph(CG, nullptr);
	computeRepresentationGraphs(CG, l_clusterRepGraph);

	//Now we compute the spanning trees on the representation graphs
	//are statically on the repgraphedges (we only have edge -> repedge
	//information)
	ClusterArray< EdgeArray<bool> > l_inTree(CG);
	//Weight of the representation edges
	ClusterArray< EdgeArray<double> > l_repWeight(CG);

	//Copy the weight
	for(cluster c : CG.clusters) {
		l_repWeight[c].init(*l_clusterRepGraph[c], 0.0);
	}
	for(edge e : CG.constGraph().edges) {
		l_repWeight[m_allocCluster[e]][m_repEdge[e]] = weight[e];
	}

	for(cluster c : CG.clusters)
	{
		l_inTree[c].init(*l_clusterRepGraph[c], false);
		//compute STs
		computeMinST(*l_clusterRepGraph[c], l_repWeight[c],
			l_inTree[c]);
	}

	OGDF_ASSERT(isConnected(CG.constGraph()));

	//Compute the subclustered graph
	for(edge e : CG.constGraph().edges)
	{
		if (l_inTree[m_allocCluster[e]][m_repEdge[e]])
			inST[e] = true;
		else inST[e] = false;
	}
#ifdef OGDF_DEBUG
	GraphCopy cg(CG.constGraph());
	for(edge e : CG.constGraph().edges)
	{
		if (!inST[e])
			cg.delEdge(cg.copy(e));
	}
	OGDF_ASSERT(isConnected(cg));
	OGDF_ASSERT(cg.numberOfEdges() == cg.numberOfNodes()-1);

#endif
	//unregister the edgearrays to avoid destructor failure after
	//representation graph deletion
	for(cluster c : CG.clusters)
	{
		l_inTree[c].init();
		l_repWeight[c].init();
	}

	deleteRepresentationGraphs(CG, l_clusterRepGraph);
}