scieee AI-readable full text Open interactive document viewer

Optimizing path analysis inmulti-perspective graphs: Astudy on the migration from NetworkX to graph-tool

Ferreira, Welber; Gomes, Antônio Tadeu Azevedo

Full text

Optimizing path analysis in multi-perspective graphs: A study on the migration from NetworkX to graph-tool Welber P. Ferreira ([email protected]) Antˆonio T. A. Gomes ([email protected])∗ LNCC, Petr´opolis – RJ – Brazil Mapping patient trajectories is essential for understanding the functioning of the healthcare system. Traditional models face limitations in representing multiple dimensions of care and handling event repetitions and temporal intervals. The framework introduced in Rosa’s doctoral thesis [1] employs MultiAspect Graphs (MAGs) [2] to represent the journeys of patients with chronic conditions, integrating multiple perspectives of care. Initially implemented using the NetworkX library [3], the framework exhibited performance limitations. This work refactors the framework using the graph-tool library [4], which offers higher efficiency due to its C++ implementation and support for parallel computation. This work compares the two implementations, searching for significant performance and scalability gains while preserving the fidelity and analytical capabilities of the original model. Performance comparisons were based on execution time and memory usage using a real patient dataset. The graph created from this dataset has 473,770 nodes and 1,888,738 edges. Automated tests involving critical operations (graph building, node filtering, dimensionality reduction, centralities computation) ensured semantic equivalence between implementations. Our results demonstrate the significant performance improvement achieved by refactoring MAG operations from NetworkX to graph-tool. The refactoring resulted in considerable reductions in execution time across all tested functions, highlighting the computational benefits of using a C++-based back end. Notably, substantial reductions in execution time were observed in the dimensionality reduction (58.9%) and node filtering (52.9%) stages. While graph-tool is efficient in most steps, memory profiling reveals that operations such as node filtering and edge reconnection can lead to a significantly higher memory usage (24.6%) than NetworkX. These findings underscore the importance of balancing speed and memory demands when dealing with large-scale, multi-perspective graph processing. [1] Rosa, C. O. C. S. “Complex networks to model and mine patient pathways.” Doctoral Thesis, LNCC. 2024. https://serra.lncc.br/handle/1/378 [2] Wehmuth, K., Fleury, E., & Ziviani, A. MultiAspect Graphs: Algebraic representation and algorithms. CoRR, abs/1504.07893. 2015. http://arxiv.org/abs/1504.07893 [3] Hagberg, A., Swart, P. J., & Schult, D. A. NetworkX – Network Analysis in Python. 2024. https://networkx.org/ [4] Peixoto, T. P. The graph-tool Python library. 2025. https://graph-tool.skewed.de/ ∗The authors thank CAPES and the LNCC Artificial Intelligence Institute (instituto.ia.lncc.br) for the financial support. 1