Work

The Triangle Finding Problem

Year: 2025
Type: preprint
Abstract: This paper presents an efficient algorithm for detecting and enumerating triangles in a graph represented by an adjacency matrix. The algorithm employs a modified Depth-First Search (DFS) approach combined with a novel coloring scheme, where each visited node is assigned a color based on its parent node in the DFS tree. This coloring scheme allows for efficient detection of the third edge required to complete a triangle. The algorithm achieves a time complexity of O(n + m), where n is the number of vertices and m is the number of edges. This approach avoids expensive matrix multiplications, making it particularly effective for sparse graphs. The algorithm can be easily adapted to enumerate all triangles while preserving the O(n + m) time complexity. We provide a detailed proof of correctness and a runtime analysis, demonstrating the algorithm's linear time performance.
Source: HAL
Author: Vega, Frank
Language: English
Open Access status: green
OpenAlex ID: W4406485167
Cites: 4
Cited by:
Related to: 8