> ## Documentation Index
> Fetch the complete documentation index at: https://prefect-bd373955-pytest-markdown.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Visualize flow structure

> Learn how to view the overall structure of your flow.

Get a quick view of the structure of your flow using the `.visualize()` method.
Calling this method attempts to produce a schematic diagram of your flow and tasks without
actually running your flow code.

<Warning>
  Functions and code outside of flows or tasks will still be run when calling
  `.visualize()`. This may have unintended consequences. Place your code into tasks to
  avoid unintended
  execution.
</Warning>

To use the `visualize()` method, you must havae Graphviz installed and on your PATH.
Please install Graphviz from [http://www.graphviz.org/download/](http://www.graphviz.org/download/).

<Note>
  Just installing the `graphviz` python package is not sufficient.
</Note>

```python
from prefect import flow, task

@task(name="Print Hello")
def print_hello(name):
    msg = f"Hello {name}!"
    print(msg)
    return msg

@task(name="Print Hello Again")
def print_hello_again(name):
    msg = f"Hello {name}!"
    print(msg)
    return msg

@flow(name="Hello Flow")
def hello_world(name="world"):
    message = print_hello(name)
    message2 = print_hello_again(message)

if __name__ == "__main__":
    hello_world.visualize()
```

![A simple flow visualized with the .visualize() method](https://mintlify.s3-us-west-1.amazonaws.com/prefect-bd373955-pytest-markdown/3.0rc/img/orchestration/hello-flow-viz.png)

Prefect cannot automatically produce a schematic for dynamic workflows, such as those with loops or
if/else control flow.
In this case, you can provide tasks with mock return values for use in the `visualize()` call.

```python
from prefect import flow, task
@task(viz_return_value=[4])
def get_list():
    return [1, 2, 3]

@task
def append_one(n):
    return n.append(6)

@flow
def viz_return_value_tracked():
    l = get_list()
    for num in range(3):
        l.append(5)
        append_one(l)

if __name__ == "__main__":
    viz_return_value_tracked.visualize()
```

![A flow with return values visualized with the .visualize() method](https://mintlify.s3-us-west-1.amazonaws.com/prefect-bd373955-pytest-markdown/3.0rc/img/orchestration/viz-return-value-tracked.png)
