cascade.graph.marginalize
- cascade.graph.marginalize(digraph, margin, max_steps)[source]
Marginalize a directed graph by keeping only a subset of observed nodes, optionally inferring indirect connections up to a maximal number of steps mediated by latent nodes.
- Parameters:
digraph (
DiGraph) – Directed graphmargin (
Collection) – A list of marginal nodesmax_steps (
int) – The maximal number of steps to infer indirect edges
- Return type:
- Returns:
Marginalized graph
Note
A new edge attribute “marginalize” is added that indicates whether the edge is direct or indirect.