Cograph Recognition Algorithm Revisited and Online Induced P 4 Search

In 1985, Corneil, Perl and Stewart CPS85] gave a linear incremental algorithm to recognize cographs (graphs with no induced P4). When this algorithm stops, either the initial graph is a cograph and the cotree of the whole graph has been built, or the initial graph is not a cograph and this algorithm ends up with a vertex v and a cotree cot such that v cannot be inserted in cot; so the input graph must contain a P4. In many applications such as graph decomposition Cou93, CH93a, CH93b, CH94, EGMS94, Spi92, MS94], transitive orientation Spi83, ST94], not only the existence but a P4 is also explicitly needed. In this paper, we present a new characterization of cograph in terms of its modular structure. This characterization yields a structural labeling of the cotree for incremental cograph recognition, and we show how to go from this labeling to the Corneil et al. one's. Furthermore, we show how to adapt this algorithm in order to produce a P4 in case of failure when adding a new vertex v, in O(jN(v)j) time complexity.