diff --git a/src/V3Graph.h b/src/V3Graph.h index 1cfac53e9..fd7d0d962 100644 --- a/src/V3Graph.h +++ b/src/V3Graph.h @@ -102,8 +102,13 @@ public: /// Order all vertices by rank and fanout, lowest first /// Sort all vertices by rank and fanout, lowest first /// Sort all edges by weight, lowest first + /// Side-effect: assigns ranks to every node. void order(); + // Similar to order() but does not assign ranks. Caller must + // ensure that the graph has been ranked ahead of the call. + void orderPreRanked(); + /// Make acyclical (into a tree) by breaking a minimal subset of cutable edges. void acyclic(V3EdgeFuncP edgeFuncp); diff --git a/src/V3GraphAlg.cpp b/src/V3GraphAlg.cpp index 6c8f1f1e3..ac9b41b27 100644 --- a/src/V3GraphAlg.cpp +++ b/src/V3GraphAlg.cpp @@ -507,7 +507,10 @@ void V3Graph::order() { // Compute rankings again rank(&V3GraphEdge::followAlwaysTrue); + orderPreRanked(); +} +void V3Graph::orderPreRanked() { // Compute fanouts // Vertex::m_user begin: 1 indicates processing, 2 indicates completed userClearVertices();