Skip to main content

Overview

The tuist graph command generates a visual representation of your project’s dependency graph. It analyzes the relationships between targets and outputs the graph in various formats including images (PNG, SVG) and structured data (DOT, JSON).

Usage

Arguments

string[]
A list of targets to filter. Only those targets and their dependent targets will be shown in the graph. If no targets are specified, all targets are included.

Options

string
default:"png"
Output format for the graph. Available formats:
  • png - PNG image (default)
  • svg - SVG vector image
  • dot - GraphViz DOT format (plain text)
  • json - JSON representation
  • legacyJSON - Legacy JSON format
string
Short form of --format.
string
default:"dot"
GraphViz layout algorithm to use. Available algorithms:
  • dot - Hierarchical layout (default, best for directed graphs)
  • neato - Spring model layout
  • twopi - Radial layout
  • circo - Circular layout
  • fdp - Force-directed layout
  • sfdp - Scaled force-directed layout (for large graphs)
  • patchwork - Squarified tree map layout
string
Short form of --algorithm.
boolean
default:"false"
Skip test targets during graph rendering.
boolean
Short form of --skip-test-targets.
boolean
default:"false"
Skip external dependencies (like Swift packages) in the graph.
boolean
Short form of --skip-external-dependencies.
string
Filter targets by platform. Only targets for this platform will be shown. Available platforms: ios, macos, tvos, watchos.
string
Short form of --platform.
boolean
default:"false"
Don’t open the generated file automatically. By default, the graph opens after generation.
string
default:"."
The path to the directory that contains the project.
string
Short form of --path.
string
default:"."
The path where the graph will be generated.
string
Short form of --output-path.

Examples

Generate default graph

Generates a PNG image of the complete dependency graph and opens it automatically.

Generate SVG graph

Creates a scalable vector graphics file of the dependency graph.

Generate DOT format

Outputs the graph in GraphViz DOT format, useful for processing with other tools.

Export to JSON

Exports the graph structure as JSON for programmatic analysis.

Focus on specific targets

Generates a graph showing only App, AppKit, and their dependencies.

Skip test targets

Creates a graph excluding all test targets for a cleaner view.

Skip external dependencies

Generates a graph without external dependencies like Swift packages.

Filter by platform

Shows only iOS targets and their dependencies.

Use different layout algorithm

Generates a circular layout, useful for showing cyclical dependencies.

Large graph optimization

Uses the scaled force-directed algorithm, optimized for large graphs.

Save without opening

Saves the graph to a specific location without opening it.

Complex filtering

Generates a focused graph for MyFeature on iOS, excluding tests and external dependencies.

Graph visualization

The generated graph shows:
  • Nodes: Represent targets in your project
  • Edges: Show dependencies between targets
  • Colors: Different node colors may indicate target types
  • Direction: Arrows show the dependency direction (A → B means A depends on B)

Layout algorithms guide

Choosing the right algorithm depends on your graph structure:
  • dot: Best for most projects, creates a hierarchical top-to-bottom layout
  • neato: Good for small to medium graphs with no clear hierarchy
  • circo: Useful for visualizing circular dependencies or feedback loops
  • sfdp: Recommended for very large graphs (100+ targets)
  • twopi: Creates a radial layout with one root node at the center
  • fdp: Similar to neato but with different force calculations
  • patchwork: Creates a space-filling layout, useful for showing relative sizes

Use cases

Understand dependencies

Visualize how targets depend on each other:

Detect circular dependencies

Use circular layout to identify dependency cycles:

Architecture review

Generate clean graphs for documentation or code review:

Analyze feature modules

Focus on specific feature dependencies:

Export for tooling

Generate JSON for custom analysis scripts:
For large projects, combine --skip-test-targets and --skip-external-dependencies to create more readable graphs. You can also focus on specific targets to reduce complexity.
The dot format output can be processed with GraphViz tools for custom visualization or integrated into documentation pipelines.