MMSubgraphPlanarizer::MMSubgraphPlanarizer() { FastPlanarSubgraph *s = new FastPlanarSubgraph(); s->runs(100); m_subgraph.set(s); MMFixedEmbeddingInserter *pInserter = new MMFixedEmbeddingInserter(); pInserter->removeReinsert(MMEdgeInsertionModule::rrAll); m_inserter.set(pInserter); m_permutations = 1; }
// default constructor SubgraphPlanarizer::SubgraphPlanarizer() { FastPlanarSubgraph* s = new FastPlanarSubgraph(); s->runs(64); m_subgraph.set(s); VariableEmbeddingInserter *pInserter = new VariableEmbeddingInserter(); pInserter->removeReinsert(rrAll); m_inserter.set(pInserter); m_permutations = 1; m_setTimeout = true; #ifdef OGDF_MEMORY_POOL_NTS m_maxThreads = 1; #else m_maxThreads = System::numberOfProcessors(); #endif }
int main() { Graph G; GraphAttributes GA(G, GraphAttributes::nodeGraphics | GraphAttributes::edgeGraphics | GraphAttributes::nodeLabel | GraphAttributes::edgeStyle | GraphAttributes::nodeStyle | GraphAttributes::nodeTemplate); GraphIO::readGML(GA, G, "ERDiagram.gml"); PlanarizationLayout pl; SubgraphPlanarizer *crossMin = new SubgraphPlanarizer; FastPlanarSubgraph *ps = new FastPlanarSubgraph; ps->runs(100); VariableEmbeddingInserter *ves = new VariableEmbeddingInserter; ves->removeReinsert(rrAll); crossMin->setSubgraph(ps); crossMin->setInserter(ves); EmbedderMinDepthMaxFaceLayers *emb = new EmbedderMinDepthMaxFaceLayers; pl.setEmbedder(emb); OrthoLayout *ol = new OrthoLayout; ol->separation(20.0); ol->cOverhang(0.4); pl.setPlanarLayouter(ol); pl.call(GA); GraphIO::writeGML(GA, "ERDiagram-layout.gml"); return 0; }
double MaxCPlanarMaster::heuristicInitialLowerBound() { double lbound = 0.0; //In case we only have a single (root) cluster, we can //use the result of a fast Max Planar Subgraph heuristic //to initialize the lower bound if ( (m_C->numberOfClusters() == 1) && (m_mpHeuristic) ) { //we run both heuristics that currently exist in OGDF //MaxSimple MaximalPlanarSubgraphSimple simpleHeur; List<edge> delEdgesList; simpleHeur.call(*m_G, delEdgesList); FastPlanarSubgraph fastHeur; fastHeur.runs(m_fastHeuristicRuns); List<edge> delEdgesListFast; fastHeur.call(*m_G, delEdgesListFast); lbound = m_G->numberOfEdges()-min(delEdgesList.size(), delEdgesListFast.size()); if (!isConnected(*m_G)) lbound = lbound-1.0; //#edges*epsilon }//if heuristics used return lbound; }//heuristicInitialLowerBound
CRevisionGraphWnd::CRevisionGraphWnd() : CWnd() , m_SelectedEntry1(nullptr) , m_SelectedEntry2(nullptr) , m_HeadNode(nullptr) , m_pDlgTip(nullptr) , m_nFontSize(12) , m_bTweakTrunkColors(true) , m_bTweakTagsColors(true) , m_fZoomFactor(DEFAULT_ZOOM) , m_ptRubberEnd(0,0) , m_ptMoveCanvas(0,0) , m_bShowOverview(false) , m_parent(nullptr) , m_hoverIndex(nullptr) , m_hoverGlyphs (0) , m_tooltipIndex(nullptr) , m_showHoverGlyphs (false) , m_bIsCanvasMove(false) , m_previewWidth(0) , m_previewHeight(0) , m_previewZoom(1) , m_ullTicks(0) , m_logEntries(&m_LogCache) , m_bCurrentBranch(false) , m_bLocalBranches(FALSE) { memset(&m_lfBaseFont, 0, sizeof(LOGFONT)); std::fill_n(m_apFonts, MAXFONTS, nullptr); WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); #define REVGRAPH_CLASSNAME _T("Revgraph_windowclass") if (!(::GetClassInfo(hInst, REVGRAPH_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_DBLCLKS | CS_OWNDC; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = nullptr; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); wndcls.lpszMenuName = nullptr; wndcls.lpszClassName = REVGRAPH_CLASSNAME; RegisterClass(&wndcls); } m_bTweakTrunkColors = CRegDWORD(_T("Software\\TortoiseGit\\RevisionGraph\\TweakTrunkColors"), TRUE) != FALSE; m_bTweakTagsColors = CRegDWORD(_T("Software\\TortoiseGit\\RevisionGraph\\TweakTagsColors"), TRUE) != FALSE; m_szTip[0] = 0; m_wszTip[0] = 0; m_GraphAttr.init(this->m_Graph, ogdf::GraphAttributes::nodeGraphics | ogdf::GraphAttributes::edgeGraphics | ogdf:: GraphAttributes::nodeLabel | ogdf::GraphAttributes::nodeColor | ogdf::GraphAttributes::edgeColor | ogdf::GraphAttributes::edgeStyle | ogdf::GraphAttributes::nodeStyle | ogdf::GraphAttributes::nodeTemplate); m_SugiyamLayout.setRanking(::new ogdf::OptimalRanking()); m_SugiyamLayout.setCrossMin(::new ogdf::MedianHeuristic()); double pi = 3.1415926; m_ArrowCos = cos(pi/8); m_ArrowSin = sin(pi/8); this->m_ArrowSize = 8; #if 0 ogdf::node one = this->m_Graph.newNode(); ogdf::node two = this->m_Graph.newNode(); ogdf::node three = this->m_Graph.newNode(); ogdf::node four = this->m_Graph.newNode(); m_GraphAttr.width(one)=100; m_GraphAttr.height(one)=200; m_GraphAttr.width(two)=100; m_GraphAttr.height(two)=100; m_GraphAttr.width(three)=100; m_GraphAttr.height(three)=20; m_GraphAttr.width(four)=100; m_GraphAttr.height(four)=20; m_GraphAttr.labelNode(one)="One"; m_GraphAttr.labelNode(two)="Two"; m_GraphAttr.labelNode(three)="three"; this->m_Graph.newEdge(one, two); this->m_Graph.newEdge(one, three); this->m_Graph.newEdge(two, four); this->m_Graph.newEdge(three, four); #endif FastHierarchyLayout *pOHL = ::new FastHierarchyLayout; //It will auto delte when m_SugiyamLayout destory pOHL->layerDistance(30.0); pOHL->nodeDistance(25.0); m_SugiyamLayout.setLayout(pOHL); #if 0 //this->m_OHL.layerDistance(30.0); //this->m_OHL.nodeDistance(25.0); //this->m_OHL.weightBalancing(0.8); m_SugiyamLayout.setLayout(&m_OHL); m_SugiyamLayout.call(m_GraphAttr); #endif #if 0 PlanarizationLayout pl; FastPlanarSubgraph *ps = ::new FastPlanarSubgraph; ps->runs(100); VariableEmbeddingInserter *ves = ::new VariableEmbeddingInserter; ves->removeReinsert(EdgeInsertionModule::rrAll); pl.setSubgraph(ps); pl.setInserter(ves); EmbedderMinDepthMaxFaceLayers *emb = ::new EmbedderMinDepthMaxFaceLayers; pl.setEmbedder(emb); OrthoLayout *ol =::new OrthoLayout; ol->separation(20.0); ol->cOverhang(0.4); ol->setOptions(2+4); ol->preferedDir(OrthoDir::odEast); pl.setPlanarLayouter(ol); pl.call(m_GraphAttr); node v; forall_nodes(v,m_Graph) { TRACE(_T("node x %f y %f %f %f\n"),/* m_GraphAttr.idNode(v), */ m_GraphAttr.x(v), m_GraphAttr.y(v), m_GraphAttr.width(v), m_GraphAttr.height(v) ); }