# networkx.generators.cographs.random_cograph¶

random_cograph(n, seed=None)[source]

Returns a random cograph with $$2 ^ n$$ nodes.

A cograph is a graph containing no path on four vertices. Cographs or $$P_4$$-free graphs can be obtained from a single vertex by disjoint union and complementation operations.

This generator starts off from a single vertex and performes disjoint union and full join operations on itself. The decision on which operation will take place is random.

Parameters
• n (int) – The order of the cograph.

• seed (integer, random_state, or None (default)) – Indicator of random number generation state. See Randomness.

Returns

G

Return type

A random graph containing no path on four vertices.

full_join(), union()