n8n Subworkflow Dependency Graph & Auto-Tagging
This workflow automatically analyzes and constructs a dependency graph between workflows, helping users identify the callers of sub-workflows and automatically tagging them. Through visual charts, users can intuitively understand the call frequency and structure between workflows, reducing maintenance costs and preventing operational errors. At the same time, this workflow is suitable for teams and enterprises managing complex automation processes, enhancing workflow management efficiency and ensuring the stability and healthy development of processes.

Workflow Name
n8n Subworkflow Dependency Graph & Auto-Tagging
Key Features and Highlights
This workflow automatically analyzes all workflows within an n8n instance to identify and construct a subworkflow dependency graph, illustrating which workflows invoke which subworkflows. Additionally, it auto-tags subworkflows with labels corresponding to their callers, enabling users to clearly understand the invocation relationships between workflows. The workflow also provides visualization of the dependency graph and call frequency distribution through MermaidJS diagrams and pie charts for intuitive insights.
Core Problems Addressed
In complex n8n automation environments, the large number of workflows and their interdependencies make manual tracking of invocation relationships and dependencies challenging, often leading to maintenance difficulties and potential errors. This workflow automates the construction of dependency graphs and tagging process, enabling comprehensive management of workflow invocation relationships, reducing maintenance overhead, and preventing accidental disruptions to subworkflow logic.
Use Cases
- Enterprises or teams using n8n to build numerous automation workflows that require management and maintenance of multiple interdependent subworkflows.
- Situations where a clear understanding of workflow invocation relationships is needed for optimization and documentation purposes.
- Automation operations personnel who want to monitor subworkflow dependencies and invocation frequencies through visual charts.
- Scenarios requiring periodic review and updating of subworkflow tags to maintain accurate workflow metadata.
Main Process Steps
- Triggered on schedule or manually activated to retrieve all current workflow data from the n8n instance.
- Parse and build the subworkflow dependency graph via a code node, identifying callers and the subworkflows they invoke.
- Filter out subworkflows that are not called or do not exist to ensure data accuracy.
- Count the number of callers for each subworkflow and identify any new callers.
- Retrieve all existing tags, exclude those already present, and create new tags for newly identified callers.
- Automatically update the corresponding caller tags on subworkflows to implement auto-tagging functionality.
- Generate MermaidJS format diagrams representing invocation relationships and provide visualizations via Webhook.
- Create pie charts using the QuickChart node to display the distribution of subworkflow invocation frequencies.
Involved Systems and Services
- n8n built-in API (for retrieving workflows, tags, and updating tags)
- HTTP Request node for invoking n8n APIs
- Code node (JavaScript) for dependency calculation and data transformation
- MermaidJS for generating visual dependency graphs
- QuickChart for producing invocation frequency pie charts
- Webhook for displaying dependency diagrams in the browser
Target Users and Value
- n8n platform administrators and developers
- Teams and enterprises managing complex automation workflows
- Automation workflow designers and maintainers
- Professionals aiming to improve workflow management efficiency and ensure process stability
By leveraging this workflow, users can effortlessly grasp the invocation dependencies among workflows in complex automation environments, automatically maintain caller tags, enhance management transparency and maintenance efficiency, avoid potential disruptions, and promote the healthy development of their automation systems.