A library to compute the modular decomposition of a simple, undirected graph.
This project implements several algorithms for computing the modular decomposition and evaluates them. It is structures as follows.
Library
crates/modular-decompositionA crate providing thefracturealgorithm based on [HPV99] and [CHM02] as a library.
Algorithms
crates/linear-ref-sys/crates/linear-refBindings and wrapper to reference C++ implementation [Miz23] based on [TCHP08].crates/linearRust port of [Miz23] based on [TCHP08].crates/skeletonBased on [MS00].crates/fractureBased on [HPV99] and [CHM02]. Uses the implementation incrates/modular-decomposition.
Others
crates/commonCommon utilities shared by the algorithm cratecrates/playgroundA crate to experiment with related algorithms and data structures.crates/evaluationEvaluation of the algorithms on real-world and generated data.
The crate crates/modular-decomposition provides an API to compute the modular decomposition.
use petgraph::graph::UnGraph;
use modular_decomposition::{ModuleKind, modular_decomposition};
let graph = UnGraph::<(), ()>::from_edges([(0, 1), (1, 2), (2, 3)]);
let md = modular_decomposition(&graph)?;
assert_eq!(md.module_kind(md.root()), Some(&ModuleKind::Prime));This figure shows the algorithm performance for some datasets.
The time for multiple runs is averaged for each instance and algorithm. The time for each algorithm is divided by the best time and the distribution is plotted.
The fracture algorithm performs best for most instances.
The evaluation code can be found in crates/evaluation.
Jonas Spinner. "A Practical Evaluation of Modular Decomposition Algorithms". https://doi.org/10.5445/IR/1000170363
@mastersthesis{Spinner2024,
doi = {10.5445/IR/1000170363},
url = {https://doi.org/10.5445/IR/1000170363},
title = {A Practical Evaluation of Modular Decomposition Algorithms},
author = {Spinner, Jonas},
year = {2024},
publisher = {{Karlsruher Institut für Technologie (KIT)}},
school = {Karlsruher Institut für Technologie (KIT)},
language = {english}
}- [HPV99] Michel Habib, Christophe Paul, and Laurent Viennot. “Partition Refinement Techniques: An Interesting Algorithmic Tool Kit”. https://doi.org/10.1142/S0129054199000125
- [CHM02] Christian Capelle, Michel Habib, and Fabien Montgolfier. “Graph Decompositions and Factorizing Permutations”. https://doi.org/10.46298/dmtcs.298
- [MS00] Ross M. Mcconnell and Jeremy P. Spinrad. “Ordered Vertex Partitioning”. https://doi.org/10.46298/dmtcs.274
- [TCHP08] Marc Tedder, Derek Corneil, Michel Habib, and Christophe Paul. “Simpler Linear-Time Modular Decomposition Via Recursive Factorizing Permutations”. https://doi.org/10.1007/978-3-540-70575-8_52
- [Miz23] https://github.com/mogproject/modular-decomposition
- [Kar19] https://github.com/StefanKarpinski/GraphModularDecomposition.jl
