Overview
Thetuist 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
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
Output format for the graph. Available formats:
png- PNG image (default)svg- SVG vector imagedot- GraphViz DOT format (plain text)json- JSON representationlegacyJSON- Legacy JSON format
Short form of
--format.GraphViz layout algorithm to use. Available algorithms:
dot- Hierarchical layout (default, best for directed graphs)neato- Spring model layouttwopi- Radial layoutcirco- Circular layoutfdp- Force-directed layoutsfdp- Scaled force-directed layout (for large graphs)patchwork- Squarified tree map layout
Short form of
--algorithm.Skip test targets during graph rendering.
Short form of
--skip-test-targets.Skip external dependencies (like Swift packages) in the graph.
Short form of
--skip-external-dependencies.Filter targets by platform. Only targets for this platform will be shown. Available platforms:
ios, macos, tvos, watchos.Short form of
--platform.Don’t open the generated file automatically. By default, the graph opens after generation.
The path to the directory that contains the project.
Short form of
--path.The path where the graph will be generated.
Short form of
--output-path.Examples
Generate default graph
Generate SVG graph
Generate DOT format
Export to JSON
Focus on specific targets
App, AppKit, and their dependencies.
Skip test targets
Skip external dependencies
Filter by platform
Use different layout algorithm
Large graph optimization
Save without opening
Complex filtering
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:The
dot format output can be processed with GraphViz tools for custom visualization or integrated into documentation pipelines.