# ask-the-community

Heidi Hurst

11/20/2023, 4:27 PM
Hi folks - is it possible to access the actual DAG contained in a workflow? That is, to see how the nodes are dependent on one another? (Obviously this is known when the DAG is created, but it's somewhat implicit, and we'd like to have an explicit representation to look at for data validation...)
For static workflows, this can be done via the following, but I'm curious if something similar can be done for dynamic workflows
Copy code
def get_node_dependencies(workflow) -> dict[str, list[str]]:
    links = {}
    for node in workflow.nodes:
        links[] = [ for n in node.upstream_nodes]
    return links

Ketan (kumare3)

11/20/2023, 5:13 PM
Can you help me understand how does this help

Heidi Hurst

11/20/2023, 6:09 PM
Fair question @Ketan (kumare3) - basically I have a dynamic workflow which runs some tasks if a user requests them based on an input object
. However, some of those tasks have upstream dependencies, which can also be requested independently. If a user requests a task which has upstream dependencies, but they do not explicitly request those dependencies in
, we'd like to automatically add them to
so that the workflow can complete successfully. While we can manually describe the relationships between these tasks, since they're already part of a workflow which already converts these tasks into a DAG, we were wondering if it was possible to leverage that DAG directly 🤔