Submitted:
03 March 2026
Posted:
04 March 2026
Read the latest preprint version here
Abstract
Keywords:
MSC: 05C69; 68Q25; 68Q17; 68Q15
1. Introduction
- 1.
- Triangle Enumeration: List all .
- 2.
- Triangle Detection: Determine whether and return a single witness if one exists.
2. The Aegypti Algorithm
2.1. Notation
2.2. Algorithm Specification
| Algorithm 1 Adaptive Triangle Enumeration and Detection |
![]() |
3. Theoretical Analysis
3.1. Correctness
3.2. Complexity Analysis: Enumeration
3.3. Complexity Analysis: Detection
- 1.
-
Success case (): If the maximum-degree vertex participates in at least one triangle, then in the worst case , givingWhen the local clustering coefficient , the expected number of neighbor pairs inspected before detection is , so the expected search time reduces to .
- 2.
-
Failure case (): If no triangle exists, thengiving .
4. Experimental Evaluation
4.1. Setup
- Processor: 11th Gen Intel Core i7-1165G7 @ 2.80 GHz
- Memory: 32 GB DDR4 RAM
- Operating System: Windows 10 Home
- Python 3.12.0; aegypti v0.3.7; numpy (matrix multiplication baseline)
4.2. Triangle Detection
- Aegypti: the algorithm presented in this paper, with .
- Matrix Multiplication (MatMul): a classical approach based on squaring the adjacency matrix; its time complexity is at least [1]. Unlike Aegypti, this baseline only verifies the existence of a triangle (it does not return a specific witness).
4.3. Discussion of Detection Results
4.4. Triangle Enumeration
4.5. Discussion of Enumeration Results
5. Impact
- Social Network Analysis: Identifying tightly-knit communities through local clustering coefficients and transitivity ratios.
- Bioinformatics: Detecting protein–protein interaction motifs in biological networks [7].
- Web and Graph Mining: Analyzing link structures and network topology in large sparse graphs [8].
6. Conclusions
Acknowledgments
References
- Alon, N.; Yuster, R.; Zwick, U. Finding and counting given length cycles. Algorithmica 1997, 17, 209–223. [Google Scholar] [CrossRef]
- Patrascu, M. Towards polynomial lower bounds for dynamic problems. In Proceedings of the Proceedings of the Forty-Second ACM Symposium on Theory of Computing, New York, NY, USA, 2010; STOC ’10, pp. 603–610. [Google Scholar] [CrossRef]
- Chiba, N.; Nishizeki, T. Arboricity and Subgraph Listing Algorithms. SIAM Journal on computing 1985, 14, 210–223. [Google Scholar] [CrossRef]
- Vega, F. Aegypti: Triangle-Free Solver. Available online: https://pypi.org/project/aegypti (accessed on 1 March 2026).
- Cliques, Coloring, and Satisfiability: Second DIMACS Implementation Challenge, October 11–13, 1993. In DIMACS Series in Discrete Mathematics and Theoretical Computer Science; American Mathematical Society: Providence, Rhode Island, 1996; Vol. 26.
- Roars. NP-Complete Benchmark Instances. Vertex cover benchmark collection. Available online: https://roars.dev/npbench/.
- Milo, R.; Shen-Orr, S.; Itzkovitz, S.; Kashtan, N.; Chklovskii, D.; Alon, U. Network Motifs: Simple Building Blocks of Complex Networks. Science 2002, 298, 824–827. [Google Scholar] [CrossRef] [PubMed]
- Newman, M.E. The Structure and Function of Complex Networks. SIAM Review 2003, 45, 167–256. [Google Scholar] [CrossRef]
| Instance | n | Witness | Aegypti | MatMul |
| (ms) | (ms) | |||
| brock | ||||
| brock200_1 | 200 | (1,2,146) | 0.0 | 0.0 |
| brock200_2 | 200 | (2,5,140) | 0.0 | 0.0 |
| brock200_3 | 200 | (1,2,97) | 0.0 | 15.77 |
| brock200_4 | 200 | (2,3,136) | 0.0 | 0.0 |
| brock400_1 | 400 | (2,6,60) | 0.0 | 23.27 |
| brock400_2 | 400 | (1,4,194) | 0.0 | 10.45 |
| brock400_3 | 400 | (2,7,84) | 2.00 | 23.21 |
| brock400_4 | 400 | (1,13,129) | 0.0 | 15.94 |
| brock800_1 | 800 | (2,7,534) | 0.0 | 250.52 |
| brock800_2 | 800 | (1,3,445) | 0.0 | 250.81 |
| brock800_3 | 800 | (2,12,561) | 15.78 | 245.21 |
| brock800_4 | 800 | (2,4,346) | 0.0 | 240.04 |
| c-fat | ||||
| c-fat200-1 | 200 | (1,3,17) | 0.0 | 15.83 |
| c-fat200-2 | 200 | (1,4,6) | 0.0 | 15.84 |
| c-fat200-5 | 200 | (1,3,6) | 0.0 | 9.15 |
| c-fat500-1 | 500 | (1,3,22) | 0.0 | 239.21 |
| c-fat500-2 | 500 | (1,3,22) | 0.0 | 262.77 |
| c-fat500-5 | 500 | (1,3,6) | 0.0 | 214.29 |
| c-fat500-10 | 500 | (1,3,6) | 0.0 | 127.17 |
| C (random k-colorable) | ||||
| C125.9 | 125 | (3,42,83) | 0.0 | 0.0 |
| C250.9 | 250 | (11,43,217) | 0.0 | 5.94 |
| C500.9 | 500 | (9,90,496) | 2.00 | 18.31 |
| C1000.9 | 1000 | (4,151,208) | 15.95 | 155.02 |
| C2000.5 | 2000 | (1,2,1402) | 0.0 | 8747.55 |
| C2000.9 | 2000 | (3,130,1619) | 79.49 | 1541.15 |
| C4000.5 | 4000 | (2,5,3701) | 6.01 | 52246.08 |
| MANN | ||||
| MANN_a9 | 45 | (10,11,12) | 0.0 | 0.0 |
| MANN_a27 | 378 | (28,29,30) | 0.0 | 0.0 |
| MANN_a45 | 1035 | (52,53,54) | 0.0 | 11.04 |
| MANN_a81 | 3321 | (82,83,84) | 6.15 | 4.51 |
| keller | ||||
| keller4 | 171 | (1,2,46) | 1.02 | 4.04 |
| keller5 | 776 | (1,2,220) | 16.21 | 144.20 |
| keller6 | 3361 | (1,2,1000) | 6.01 | 8673.51 |
| Instance | n | Witness | Aegypti | MatMul |
| (ms) | (ms) | |||
| hamming | ||||
| hamming6-2 | 64 | free | 0.0 | 0.0 |
| hamming6-4 | 64 | (1,2,3) | 0.0 | 0.0 |
| hamming8-2 | 256 | free | 2.00 | 0.0 |
| hamming8-4 | 256 | (1,2,3) | 2.01 | 12.49 |
| hamming10-2 | 1024 | free | 4.67 | 3.03 |
| hamming10-4 | 1024 | (1,2,3) | 0.0 | 208.88 |
| johnson | ||||
| johnson8-2-4 | 28 | (1,2,3) | 0.0 | 0.0 |
| johnson8-4-4 | 28 | (1,2,3) | 0.0 | 0.0 |
| johnson16-2-4 | 120 | (1,2,3) | 0.0 | 1.01 |
| johnson32-2-4 | 496 | (1,2,3) | 2.00 | 23.38 |
| gen | ||||
| gen200_p0.9_44 | 200 | (6,35,81) | 0.0 | 3.06 |
| gen200_p0.9_55 | 200 | (30,71,98) | 0.0 | 2.02 |
| gen400_p0.9_55 | 400 | (6,20,226) | 0.0 | 13.22 |
| gen400_p0.9_65 | 400 | (14,142,152) | 0.0 | 0.0 |
| gen400_p0.9_75 | 400 | (9,62,79) | 0.0 | 20.08 |
| san | ||||
| san200_0.7_1 | 200 | (9,25,122) | 0.0 | 4.06 |
| san200_0.7_2 | 200 | (1,7,144) | 0.0 | 0.0 |
| san200_0.9_1 | 200 | (27,46,50) | 0.0 | 2.25 |
| san200_0.9_2 | 200 | (6,29,83) | 0.0 | 2.03 |
| san200_0.9_3 | 200 | (7,8,171) | 1.04 | 2.05 |
| san400_0.5_1 | 400 | (1,2,67) | 0.0 | 64.33 |
| san400_0.7_1 | 400 | (1,38,152) | 0.0 | 31.77 |
| san400_0.7_2 | 400 | (1,50,375) | 0.0 | 32.05 |
| san400_0.7_3 | 400 | (3,5,347) | 0.0 | 31.61 |
| san400_0.9_1 | 400 | (1,165,177) | 0.0 | 4.66 |
| san1000 | 1000 | (4,7,252) | 0.0 | 759.66 |
| sanr | ||||
| sanr200_0.7 | 200 | (3,7,180) | 0.0 | 4.41 |
| sanr200_0.9 | 200 | (1,11,45) | 0.0 | 15.82 |
| sanr400_0.5 | 400 | (2,3,260) | 0.0 | 63.73 |
| sanr400_0.7 | 400 | (3,5,364) | 1.74 | 28.10 |
| p_hat (random) | ||||
| p_hat300-1 | 300 | (1,2,69) | 0.0 | 42.09 |
| p_hat300-2 | 300 | (1,2,69) | 0.0 | 13.84 |
| p_hat300-3 | 300 | (1,14,238) | 0.0 | 20.25 |
| p_hat500-1 | 500 | (1,3,130) | 0.0 | 162.14 |
| p_hat500-2 | 500 | (1,7,14) | 0.0 | 116.77 |
| p_hat500-3 | 500 | (2,27,125) | 0.0 | 52.46 |
| p_hat700-1 | 700 | (1,2,476) | 0.0 | 473.50 |
| p_hat700-2 | 700 | (1,2,404) | 0.0 | 302.18 |
| p_hat700-3 | 700 | (1,14,404) | 16.02 | 126.63 |
| p_hat1000-1 | 1000 | (1,2,345) | 0.0 | 1326.71 |
| p_hat1000-2 | 1000 | (2,3,31) | 0.0 | 825.60 |
| p_hat1000-3 | 1000 | (1,5,765) | 0.0 | 346.98 |
| p_hat1500-1 | 1500 | (1,2,766) | 16.21 | 4761.87 |
| p_hat1500-2 | 1500 | (2,4,766) | 0.0 | 2613.69 |
| p_hat1500-3 | 1500 | (5,27,1302) | 0.0 | 1193.38 |
| Instance | n | t (triangles) | Time |
| brock | |||
| brock200_1 | 200 | 21,639 | 21.51 ms |
| brock200_2 | 200 | 167,868 | 148.07 ms |
| brock200_3 | 200 | 80,356 | 75.77 ms |
| brock200_4 | 200 | 52,639 | 44.42 ms |
| brock400_1 | 400 | 168,535 | 207.63 ms |
| brock400_2 | 400 | 167,005 | 240.74 ms |
| brock400_3 | 400 | 169,621 | 232.85 ms |
| brock400_4 | 400 | 167,716 | 213.71 ms |
| brock800_1 | 800 | 3,666,936 | 6.44 s |
| brock800_2 | 800 | 3,606,112 | 5.26 s |
| brock800_3 | 800 | 3,686,692 | 6.21 s |
| brock800_4 | 800 | 3,654,501 | 4.99 s |
| c-fat | |||
| c-fat200-1 | 200 | 1,026,456 | 1.04 s |
| c-fat200-2 | 200 | 748,748 | 787.22 ms |
| c-fat200-5 | 200 | 163,212 | 143.98 ms |
| c-fat500-1 | 500 | 18,544,848 | 20.61 s |
| c-fat500-2 | 500 | 16,400,400 | 19.58 s |
| c-fat500-5 | 500 | 10,741,128 | 9.99 s |
| c-fat500-10 | 500 | 3,906,000 | 4.45 s |
| C (random k-colorable) | |||
| C125.9 | 125 | 344 | 0.0 ms |
| C250.9 | 250 | 2,691 | 13.30 ms |
| C500.9 | 500 | 20,197 | 48.00 ms |
| C1000.9 | 1000 | 161,793 | 285.92 ms |
| MANN | |||
| MANN_a9 | 45 | 12 | 1.01 ms |
| MANN_a27 | 378 | 117 | 0.0 ms |
| MANN_a45 | 1035 | 330 | 3.28 ms |
| MANN_a81 | 3321 | 1,080 | 7.06 ms |
| keller | |||
| keller4 | 171 | 44,076 | 18.21 ms |
| keller5 | 776 | 1,550,280 | 2.34 s |
| hamming | |||
| hamming6-2 | 64 | 0 (free) | 0.0 ms |
| hamming6-4 | 64 | 11,840 | 5.67 ms |
| hamming8-2 | 256 | 0 (free) | 1.04 ms |
| hamming8-4 | 256 | 172,032 | 95.64 ms |
| hamming10-2 | 1024 | 0 (free) | 5.82 ms |
| hamming10-4 | 1024 | 1,827,840 | 2.71 s |
| johnson | |||
| johnson8-2-4 | 28 | 336 | 0.0 ms |
| johnson8-4-4 | 28 | 1,120 | 1.01 ms |
| johnson16-2-4 | 120 | 7,840 | 15.55 ms |
| johnson32-2-4 | 496 | 148,800 | 95.51 ms |
| Instance | n | t (triangles) | Time |
| p_hat (random) | |||
| p_hat300-1 | 300 | 1,981,303 | 2.50 s |
| p_hat300-2 | 300 | 731,701 | 793.16 ms |
| p_hat300-3 | 300 | 91,774 | 80.28 ms |
| p_hat500-1 | 500 | 8,875,098 | 10.78 s |
| p_hat500-2 | 500 | 3,168,467 | 4.29 s |
| p_hat500-3 | 500 | 398,844 | 488.78 ms |
| p_hat700-1 | 700 | 24,782,782 | 34.15 s |
| p_hat700-2 | 700 | 9,110,269 | 9.89 s |
| p_hat700-3 | 700 | 1,149,951 | 1.22 s |
| p_hat1000-3 | 1000 | 3,458,328 | 5.94 s |
| san | |||
| san200_0.7_1 | 200 | 17,520 | 24.99 ms |
| san200_0.7_2 | 200 | 31,104 | 47.93 ms |
| san200_0.9_1 | 200 | 619 | 0.0 ms |
| san200_0.9_2 | 200 | 816 | 0.0 ms |
| san200_0.9_3 | 200 | 1,248 | 3.33 ms |
| san400_0.5_1 | 400 | 919,208 | 1.11 s |
| san400_0.7_1 | 400 | 115,081 | 185.10 ms |
| san400_0.7_2 | 400 | 151,555 | 242.51 ms |
| san400_0.7_3 | 400 | 200,285 | 304.20 ms |
| san400_0.9_1 | 400 | 4,381 | 15.75 ms |
| sanr | |||
| sanr200_0.7 | 200 | 36,498 | 31.84 ms |
| sanr200_0.9 | 200 | 1,425 | 15.79 ms |
| sanr400_0.5 | 400 | 1,316,783 | 1.66 s |
| sanr400_0.7 | 400 | 285,890 | 378.86 ms |
| gen | |||
| gen200_p0.9_44 | 200 | 1,660 | 4.01 ms |
| gen200_p0.9_55 | 200 | 1,416 | 0.0 ms |
| gen400_p0.9_55 | 400 | 13,193 | 32.00 ms |
| gen400_p0.9_65 | 400 | 11,553 | 31.19 ms |
| gen400_p0.9_75 | 400 | 11,405 | 26.32 ms |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
