Graph

class pqp.graph.Graph(edges=[])

Bases: object

A causal graph

Example

>>> x = Variable("X")
>>> y = Variable("Y")
>>> g = Graph([
...     y <= x,
... ])
>>> g.idc([y], [x])
P(y | x)
Parameters:

edges (list of DirectedEdge or BidirectedEdge) – the edges in the graph

Methods Summary

add_edge(edge)

Adds an edge to the graph

bi_edge_tuples()

di_edge_tuples()

draw()

Draws the causal diagram using networkx

idc(y, x[, z])

Identification of conditional interventional distribution.

Methods Documentation

add_edge(edge)

Adds an edge to the graph

Parameters:

edge (DirectedEdge or BidirectedEdge) – the edge to add

bi_edge_tuples()
di_edge_tuples()
draw()

Draws the causal diagram using networkx

idc(y, x, z=[])

Identification of conditional interventional distribution.

Parameters:
  • x (list of Variable) – intervention variables

  • y (list of Variable) – outcome variables

  • z (list of Variable) – conditioning variables (optional)

Returns:

the expression for the interventional distribution

Return type:

Expression