AbsInf: A Lightweight Object to Represent float(’inf’) in Dijkstra’s Algorithm

Anjan Bellamkonda, Laksh Bharani, Harivatsan Selvam · 2025

Read AbsInf: A Lightweight Object to Represent float(’inf’) in Dijkstra’s Algorithm by Anjan Bellamkonda, Laksh Bharani, Harivatsan Selvam (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-04302.txt.

Description

Bellamkonda, Bharani, and Selvam speed up a classic pathfinding algorithm with a custom infinity object, in a 2025 computing paper. Dijkstra's algorithm finds shortest routes through a network and starts every distance at infinity. In Python, that infinity is a float, and repeated float handling costs time. Their object, AbsInf, is a small C extension that stands for infinity directly, skipping float conversion and type checks.

Swapping it in left the algorithm's logic untouched. Runtime fell by up to 17.2 percent, averaging 9.74 percent across synthetic and real-world graphs. Comparisons with the object are constant-time, and arithmetic leaves other values neutral, as infinity should. The authors frame the trick as a case study in shaving hot spots inside interpreted languages.

Catalog record

CREATORAnjan Bellamkonda, Laksh Bharani, Harivatsan Selvam
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE17 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-04302

Browse the full library · About the Tower of Babel