dynetx.algorithms.paths.temporal_dag¶
-
dynetx.algorithms.paths.
temporal_dag
(G, u, v, start=None, end=None)¶ Creates a rooted temporal DAG assuming interaction chains of length 1 within each network snapshot.
Parameters: - G (a DynGraph or DynDiGraph object) – The graph to use for computing DAG
- u (a node id) – A node in G
- v (a node id) – A node in G
- start (temporal id) – min temporal id for bounding the DAG, default None
- end (temporal id to conclude the search) – max temporal id for bounding the DAG, default None
Returns: - DAG (a directed graph) – A DAG rooted in u (networkx DiGraph object)
- sources (source node ids) – List of temporal occurrences of u
- targets (target node ids) – List of temporal occurrences of v
- node_type (type) – network node_type
- tid_type (type) – network temporal id type
Examples
>>> import dynetx as dn >>> g = dn.DynGraph() >>> g.add_interaction("A", "B", 1, 4) >>> g.add_interaction("B", "D", 2, 5) >>> g.add_interaction("A", "C", 4, 8) >>> g.add_interaction("B", "D", 2, 4) >>> g.add_interaction("B", "C", 6, 10) >>> g.add_interaction("B", "D", 2, 4) >>> g.add_interaction("A", "B", 7, 9) >>> DAG, sources, targets, _, _ = al.temporal_dag(g, "D", "C", start=1, end=9)