arXiv:2610.24314cs.DSOct 2026

Manuscript Offprint

arXiv:2610.24314

Vertex Ordering for Exact Triangle Listing: Concave Geometry and Certified Rounding

Kourosh Mirsohi, Melika Gorgi, Erfan Hajihashemi

Abstract

Exact forward triangle listers orient each edge of a graph by a vertex order. The order does not change the output, but it changes the work. For the adaptive lister, which scans the smaller of the two forward neighborhoods, the number of candidate tests is a known sum of minima of forward degrees, but how to optimize it had not been characterized. We show that this work is a concave function of the forward degrees, so choosing an order is concave minimization over the orientation polytope, whose vertices are the forward-degree vectors of orders. A single sort therefore rounds any point of the polytope, including the out-degree vector of any orientation, to an order with no more work, with a computable lower bound on the improvement. Minimizing the work is nevertheless NP-hard and APX-hard on triangle-free graphs of maximum degree three, and under the Unique Games Conjecture it has no polynomial-time constant-factor approximation. We also analyze logistic score relaxations and the large-graph limit of degree-based orders; on random cubic graphs, the expected work of every degree-based order is asymptotically at least 2.43 times the expected optimum. Tangent refinement followed by iterated local search reduces the work by 14.83% on average on nine held-out networks fixed by a pre-registered protocol, and by 7.22% in a supplementary rescoring, specified in advance, against a stronger reference that adds the published Neigh local search. The gains are in candidate tests; we observe no reproducible wall-clock speedup.

1 Introduction

Listing all triangles of a graph is a basic primitive in graph mining [10, 21, 48, 73] and in graph learning, where subgraph counts, which message-passing networks cannot in general capture [20], enrich node and graph features [16]. In network biology, triangles define clustering coefficients [86], form the skeletons of closed three-node motifs such as the feed-forward loop [5, 60, 75], and enter graphlet analyses of brain and protein networks [72, 77]. In molecular simulations whose three-body terms require all three pairwise distances within a cutoff [69], the admissible triplets are exactly the triangles of the cutoff graph; our guarantees apply to this enumeration, but we do not evaluate simulation runtime.

Motif analysis repeats triangle listing on many randomized copies of a network [60], so the cost of listing is incurred many times. Even a single listing of a large graph can be costly, motivating parallel, distributed, and external-memory listers [22, 39, 76, 81]. Fast exact listers orient every edge from its earlier to its later endpoint under a vertex order and intersect the resulting forward neighborhoods [21, 66]. The output does not depend on the order, but the work does. On Wiki-Talk (2.4M vertices), the adaptive lister studied here (defined below) performs 4.6 times more candidate tests under the reverse of the degeneracy order than under ascending degree (Appendix G).

Problem. Let G=(V,E)G = (V, E) be a simple undirected graph with nn vertices and mm edges, and let π\pi be a strict total order of VV. The forward degree dπ+(v)d_{\pi}^{+}(v) is the number of neighbors of vv that come after vv in π\pi, and these neighbors form its forward neighborhood Nπ+(v)N_{\pi}^{+}(v). The adaptive forward lister [88] handles each edge by scanning the smaller of the forward neighborhoods of its two endpoints. Each scanned vertex is tested for membership in the other neighborhood, and we call each such test a candidate test. The total number of candidate tests is

Λ(π)=∑{u,v}∈Emin⁡{dπ+(u),dπ+(v)},(1)\Lambda(\pi)=\sum_{\{u,v\}\in E}\min\{d_{\pi}^{+}(u),d_{\pi}^{+}(v)\}, \tag{1}

which we call the work of π\pi (Proposition 1). The sum itself was given by Yu et al. [88]; what had not been characterized is its dependence on the order. We study the ordering problem ΛG∗=min⁡πΛ(π)\Lambda_G^* = \min_\pi \Lambda(\pi) and write ΛG(π)\Lambda_G(\pi) when the graph matters. For listers that always scan the forward neighborhood of one fixed endpoint, two related costs are NP-hard to minimize [50].

Prior work and open questions. In practice, vertices are ordered by degree or by degeneracy [21, 57, 66]. Lécuyer et al. [50] designed tailored orders, Split and Check, and a local search, Neigh, that can beat degeneracy orders, but for two non-adaptive costs that differ from Λ\Lambda. Differentiable relaxations of permutations [12, 23, 59] offer another route: optimize a smooth surrogate and round. What has been missing is an understanding of the objective itself: its structure, how to round without increasing the work, its hardness, why gradient-based optimization can fail, and how much degree information alone can capture.

Our results. We show that Λ\Lambda depends on the order only through the vector of forward degrees and is a concave function of it. The fractional forward-degree vectors, which split one unit per edge between its two endpoints, form the orientation polytope of G. Its vertices are exactly the forward-degree vectors of orders, so the ordering problem is concave minimization over this polytope (Section 3). Our main contributions are:

  1. Geometry and rounding. A single sort, the tangent step, rounds any point of the polytope, including the out-degree vector of any orientation, to an order whose work is no larger, with a computable lower bound on the improvement; iterating it gives tangent refinement. The same geometry gives an exact mixed-integer program without acyclicity constraints, displayed in Eq. (2) (Theorem 2, Corollary 3, Propositions 4 and 5).

  2. Complexity. Through an exact correspondence with Max-Cut on subdivided graphs, we show that minimizing Λ\Lambda is NP-hard and APX-hard even on triangle-free graphs of maximum degree three, and under the Unique Games Conjecture (UGC) it has no polynomial-time constant-factor approximation (Theorem 6). A Min UnCut connection with the same UGC consequence was known for the non-adaptive cost C+−C^{+-} [49, §5.3.3]; ours is for the adaptive cost and rests on an exact identity for the optimum on 2-subdivisions.

  3. Relaxation landscape. Pairwise-logistic (Bradley–Terry) relaxations orient each edge softly by a logistic function of unconstrained vertex-score differences at a fixed temperature. Every finite stationary point of an objective that is concave in the resulting soft forward degrees is a global maximizer. Our smoothed work is strictly concave in them on the affine hull of the polytope, so it has no finite local minimum, yet its infimum is hard to approximate, and its minimizing sequences saturate the score differences, where small gradients certify nothing about the score-sorted order (Theorem 7).

  4. Random graphs. On configuration-model random graphs with bounded degrees, the expected work per vertex of every degree-based order, which places vertices in consecutive blocks determined only by their degrees, has an explicit large-graph limit; in this limit the best layouts we found are V-shaped and do 8.7–21.4% less work than ascending degree, depending on the degree law. Yet on large random cubic graphs, the expected work of every degree-based order is at least 2.438 – o(1) times the expected optimum (Theorem 8, Proposition 9).

  5. Algorithms and evaluation. Iterated local search reaches the optimum on all 27 small instances on which a solver certifies the optimum of the program. Our method, tangent refinement followed by iterated local search (T+ILS), reduces work on 32 public development graphs by 5.70% on average relative to the best of standard and tailored reference orders in both directions, improving on every graph. On nine held-out networks whose selection was pre-registered, it reduces work by 14.83% on average relative to the pre-registered reference. In a supplementary rescoring that was specified in advance but is not part of the original pre-registration, the same orders reduce work by 7.22% against a stronger reference that adds the published local search Neigh, improving on all nine; rerun from this stronger reference, T+ILS needs fewer candidate tests than the gradient-based relaxation DOVE (Section 4.1) on all nine (Section 6). The ablations attribute most of the gain to the plateau moves and kicks of the local search, not to the tangent prefix (Sections 6.3 and 6.5).

All gains are in candidate tests. The geometric-mean listing time changes by at most a few percent, not reproducibly across machines, and ordering costs more than it saves, even when orders are reused across related graphs (Section 6.4), so we claim no end-to-end speedup. Table 16 in Appendix O separates prior ingredients from new results.

References (84)