Ejemplo n.º 1
0
void VisibilityLayout::call(GraphAttributes &GA)
{
	if (GA.constGraph().numberOfNodes() <= 1)
		return;

	//call upward planarizer
	UpwardPlanRep UPR;
	UPR.createEmpty(GA.constGraph());
	m_upPlanarizer.get().call(UPR);
	layout(GA, UPR);
}
Ejemplo n.º 2
0
void DominanceLayout::call(GraphAttributes &GA)
{
	if (GA.constGraph().numberOfNodes() <= 1)
		return;

	OGDF_ASSERT(isSimpleUndirected(GA.constGraph()));
	//call upward planarizer
	UpwardPlanRep UPR;
	UPR.createEmpty(GA.constGraph());
	m_upPlanarizer->call(UPR);
	layout(GA, UPR);
}
Ejemplo n.º 3
0
void UPRSupplier::supply(Graph& graph, UpwardPlanRep& retVal){
	node addedSource = graph.newNode();
	node addedSink = graph.newNode();
	if (outputDebug){
		cout << "\tAdded super source (" << addedSource->index() << ") and super sink (" << addedSink->index() << ")." << endl;
		cout << endl;
	}
	
	vector<edge> addedEdges;
	node n;
	forall_nodes(n, graph){
		if (n->indeg() == 0 && n != addedSource && n != addedSink) {
			edge e = graph.newEdge(addedSource, n);
			addedEdges.push_back(e);
		}
	}
	
	forall_nodes(n, graph){
		if (n->outdeg() == 0 && n != addedSource && n != addedSink) {
			edge e = graph.newEdge(n, addedSink);
			addedEdges.push_back(e);
		}
	}
	
	retVal.createEmpty(graph);
	assert(&retVal.original() == &graph);
	
	EdgeArray<int> cost (graph, this->normalCost);
	if (outputDebug)
		cout << "\tAssigning cost " << this->normalCost << " as default cost per edge" << endl;
	EdgeArray<bool> forbid (graph, false);
	
	for (vector<edge>::iterator it = addedEdges.begin(); it != addedEdges.end(); ++it){
		cost[*it] = this->sourceSinkCost;
		if (outputDebug)
			cout << "\tAssigning cost " << cost[*it] << " to " << *it << endl;
	}
	
	if (outputDebug)
		cout << endl;	
	
	SubgraphUpwardPlanarizer sup;
	FUPSSourceSink* fups = new FUPSSourceSink();
	
	fups->runs(this->runs);
	sup.setSubgraph(fups);
	
	sup.setInserter(new OutputUpwardEdgeInserter());
	
	sup.runs(this->runs);
	sup.call(retVal, &cost, &forbid);
}