Ejemplo n.º 1
0
//*************************************************************
// call for SugiyamaLayout
void SimDrawCaller::callSugiyamaLayout()
{
	m_SD->addAttribute(GraphAttributes::nodeGraphics);
	m_SD->addAttribute(GraphAttributes::edgeGraphics);

	// nodes get default size
	node v;
	forall_nodes(v, *m_G)
		m_GA->height(v) = m_GA->width(v) = 5.0;

	// actual call of SugiyamaLayout
	updateESG();
	SugiyamaLayout SL;
	SL.setSubgraphs(m_esg); // needed to call SimDraw mode
	SL.call(*m_GA);

} // end callSugiyamaLayout
Ejemplo n.º 2
0
int main()
{
	Graph G;
	GraphAttributes GA(G,
	  GraphAttributes::nodeGraphics |
	  GraphAttributes::edgeGraphics |
	  GraphAttributes::nodeLabel |
	  GraphAttributes::edgeStyle |
	  GraphAttributes::nodeStyle |
	  GraphAttributes::nodeTemplate);
	if (!GraphIO::readGML(GA, G, "unix-history-time.gml") ) {
		cerr << "Could not load unix-history-time.gml" << endl;
		return 1;
	}

	NodeArray<int> rank(G);
	int i = 0;
	node v;
	forall_nodes(v,G)
		rank[v] = r[i++];

	SugiyamaLayout SL;
	SL.setCrossMin(new MedianHeuristic);
	SL.arrangeCCs(false);

	OptimalHierarchyLayout *ohl = new OptimalHierarchyLayout;
	ohl->layerDistance(30.0);
	ohl->nodeDistance(25.0);
	ohl->weightBalancing(0.7);
	SL.setLayout(ohl);

	SL.call(GA, rank);
	GraphIO::writeGML(GA, "unix-history-time-layout.gml");

	return 0;
}