- antichains(G, topo_order=None)¶
Generates antichains from a directed acyclic graph (DAG).
An antichain is a subset of a partially ordered set such that any two elements in the subset are incomparable.
- GNetworkX DiGraph
A directed acyclic graph (DAG)
- topo_order: list or tuple, optional
A topological order for G (if None, the function will compute one)
a list of nodes in
Grepresenting an antichain
Gis not directed
Gcontains a cycle
This function was originally developed by Peter Jipsen and Franco Saliola for the SAGE project. It’s included in NetworkX with permission from the authors. Original SAGE code at:
Free Lattices, by R. Freese, J. Jezek and J. B. Nation, AMS, Vol 42, 1995, p. 226.
>>> DG = nx.DiGraph([(1, 2), (1, 3)]) >>> list(nx.antichains(DG)) [, , , [2, 3], ]