pywhy_graphs.classes.timeseries.TimeSeriesMixedEdgeGraph#
- class pywhy_graphs.classes.timeseries.TimeSeriesMixedEdgeGraph(graphs=None, edge_types=None, max_lag=1, **attr)[source]#
- A class to imbue mixed-edge graph with time-series structure. - This should not be used directly. - add_edge(u_of_edge: Tuple[int | float | str | Any, int], v_of_edge: Tuple[int | float | str | Any, int], edge_type: str = 'all', **attr)[source]#
- Add an edge between u and v. - The nodes u and v will be automatically added if they are not already in the graph. - Edge attributes can be specified with keywords or by directly accessing the edge’s attribute dictionary. - Parameters:
- u_for_edge, v_for_edgenodes
- Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects. 
- edge_typestr
- The edge type. By default ‘all’, which will then add an edge in all edge type subgraphs. 
- attrkeyword arguments, optional
- Edge data (or labels or objects) can be assigned using keyword arguments. 
 
 - See also - add_edges_from
- add a collection of edges 
 
 - add_edges_from(ebunch, edge_type='all', **attr)[source]#
- Add all the edges in ebunch_to_add. - Parameters:
- ebunch_to_addcontainer of edges
- Each edge given in the container will be added to the graph. The edges must be given as 2-tuples (u, v) or 3-tuples (u, v, d) where d is a dictionary containing edge data. 
- edge_typestr
- The edge type to add edges to. By default ‘all’, which will then add an edge in all edge type subgraphs. 
- attrkeyword arguments, optional
- Edge data (or labels or objects) can be assigned using keyword arguments. 
 
 - See also - add_edge
- add a single edge 
 - Notes - Adding the same edge twice has no effect but any edge data will be updated when each duplicate edge is added. - Edge attributes specified in an ebunch take precedence over attributes specified via keyword arguments. 
 - add_homologous_edges(u_of_edge: Tuple[int | float | str | Any, int], v_of_edge: Tuple[int | float | str | Any, int], direction='both', edge_type='all', **attr)[source]#
- Add homologous edges. - Assumes the edge that we consider is - (u_of_edge, v_of_edge), that is ‘u’ points to ‘v’.- Parameters:
- u_of_edgeTsNode
- The from node. 
- v_of_edgeTsNode
- The to node. The absolute value of the time lag should be less than or equal to the from node’s time lag. 
- directionstr, optional
- Which direction to add homologous edges to, by default ‘both’, corresponding to making the edge stationary over all time. 
 
 
 - copy()[source]#
- Returns a copy of the graph. - Exactly the same as - pywhy_graphs.networkx.MixedEdgeGraph.copy(), except this preserves the max lag graph attribute.- Parameters:
- as_viewbool, optional (default=False)
- If True, the returned graph-view provides a read-only view of the original graph without actually copying any data. 
 
- Returns:
- GGraph
- A copy of the graph. 
 
 - See also - pywhy_graphs.networkx.MixedEdgeGraph.to_directed()
- return a directed copy of the graph. 
 
 - node_attr_dict_factory#
- alias of - tsdict
 - node_dict_factory#
- alias of - tsdict
 - remove_edge(u_of_edge, v_of_edge, edge_type='all')[source]#
- Remove an edge between u and v. - Parameters:
- u, vnodes
- Remove an edge between nodes u and v. 
- edge_typestr
- The edge type. By default ‘all’, which will then remove the edge in all edge type subgraphs (if it exists). 
 
- Raises:
- NetworkXError
- If there is not an edge between u and v, or if there is no edge with the specified key. 
 
 - See also - remove_edges_from
- remove a collection of edges 
 
 - remove_edges_from(ebunch, edge_type='all')[source]#
- Remove all edges specified in ebunch. - Parameters:
- ebunch: list or container of edge tuples
- Each edge given in the list or container will be removed from the graph. The edges can be: - 2-tuples (u, v) edge between u and v. 
- 3-tuples (u, v, k) where k is ignored. 
 
 
 - See also - remove_edge
- remove a single edge 
 - Notes - Will fail silently if an edge in ebunch is not in the graph. 
 - remove_homologous_edges(u_of_edge: Tuple[int | float | str | Any, int], v_of_edge: Tuple[int | float | str | Any, int], edge_type: str = 'all', direction='both')[source]#
- Remove homologous edges. - Assumes the edge that we consider is - (u_of_edge, v_of_edge), that is ‘u’ points to ‘v’.- Parameters:
- u_of_edgeTsNode
- The from node. 
- v_of_edgeTsNode
- The to node. The absolute value of the time lag should be less than or equal to the from node’s time lag. 
- directionstr, optional
- Which direction to add homologous edges to, by default ‘both’, corresponding to making the edge stationary over all time.