find_minimal_d_separator#
- graph_tool.structure.find_minimal_d_separator(g, x, y, included=None, restricted=None)[git][source]#
Return a minimal d-separator of two sets of vertices in a directed acyclic graph.
- Parameters:
- g
Graph Directed acyclic graph.
- xiterable of
intorVertex, or a single vertex First set of vertices.
- yiterable of
intorVertex, or a single vertex Second set of vertices.
- includediterable of
intorVertex(optional, default:None) Vertices that must belong to the separator.
- restrictediterable of
intorVertex(optional, default:None) If given, the separator may contain only these vertices.
- g
- Returns:
- z
numpy.ndarrayorNone The vertices of a minimal d-separator (see
is_d_separator()), orNoneif there is none within the constraints.
- z
See also
is_d_separatorTest for d-separators
is_minimal_d_separatorTest for minimal d-separators
graph_tool.generation.moral_graphMoral graph of a directed acyclic graph
Notes
A set \(Z\) d-separates \(X\) from \(Y\) [pearl-probabilistic-1988] if every trail (path ignoring the edge directions) between a vertex of \(X\) and one of \(Y\) is blocked by \(Z\), i.e. contains a vertex \(v\) that either is a collider (both trail edges point to it) such that neither \(v\) nor any of its descendants is in \(Z\), or is not a collider and is in \(Z\) (see
is_d_separator()). The separator is minimal with respect to inclusion among those that containincluded: no vertex outsideincludedcan be removed from it. It is found with the algorithm of van der Zander and Liśkiewicz [zander-finding-2020], which restricts the candidates to the ancestors of \(X \cup Y \cup I\) and removes those not reachable by active trails from both sides, in time \(O(V + E)\).References
[pearl-probabilistic-1988]Judea Pearl, “Probabilistic Reasoning in Intelligent Systems”, Morgan Kaufmann (1988).
[zander-finding-2020]Benito van der Zander and Maciej Liśkiewicz, “Finding minimal d-separators in linear time and applications”, Proceedings of the 35th Conference on Uncertainty in Artificial Intelligence, PMLR 115, 637-647 (2020), https://proceedings.mlr.press/v115/van-der-zander20a.html
Examples
>>> g = gt.Graph([(0, 1), (1, 2), (2, 3), (1, 3)]) >>> print(gt.find_minimal_d_separator(g, 0, 3)) [1] >>> print(gt.find_minimal_d_separator(g, 0, 3, restricted=[2])) None