Graph::ModularDecomposition is a Perl module that:
Graph::Directed::stringify().
A. Ehrenfeucht, H. N. Gabow, R. M. McConnell, and S. J. Sullivan, "An O(n^2) Divide-and-Conquer Algorithm for the Prime Tree Decomposition of Two-Structures and Modular Decomposition of Graphs", Journal of Algorithms 16 (1994), pp. 283-294.
You can get this module at CPAN, in directory /authors/id/A/AZ/AZS/graph/ or download from here: