pywhy_graphs.classes.timeseries.StationaryTimeSeriesDiGraph#

class pywhy_graphs.classes.timeseries.StationaryTimeSeriesDiGraph(incoming_graph_data=None, max_lag: int = 1, stationary: bool = True, check_time_direction: bool = True, **attr)[source]#

Stationary time-series directed graph.

A stationary graph is one where lagged edges repeat themselves over time. Edges connecting to nodes in time point “t=0” are all the relevant edges needed to depict the time-series graph.

Time-series graph nodes are defined as a cross-product of variables and a time-index. Nodes are always a tuple of variables and the lag. For example, a node could be ('x', -1) indicating the ‘x’ variable at ‘-1’ lag.

Parameters:
incoming_graph_datainput graph (optional, default: None)

Data to initialize graph. If None (default) an empty graph is created. The data can be any format that is supported by the to_networkx_graph() function, currently including edge list, dict of dicts, dict of lists, NetworkX graph, 2D NumPy array, SciPy sparse matrix, or PyGraphviz graph.

max_lagint, optional

The max lag, by default 1.

attrkeyword arguments, optional (default= no attributes)

Attributes to add to graph as key=value pairs.

Attributes:
stationarybool

Whether or not the graph is stationary.

check_time_directionbool

Whether or not to check time directionality is valid, by default True. May set to False for undirected graphs.

Notes

A stationary time-series graph is one in which edges over time are repeated. In order to properly query for d-separation, one needs to query up to 2 times the maximum lag.

A ts-graph’s nodes are defined uniquely by its set of variables and the maximum-lag parameter. Given for example, ('x', 'y', 'z') as the set of variables and a maximum-lag of 2, then there would be 9 total nodes in the graph consisting of the cross-product of ('x', 'y', 'z') and (0, 1, 2). Nodes are automatically added, or deleted depending on the value of the maximum-lag in the graph.