Skip to main content

Control the Call Tree with --callers and --depth

Flip vg tree to show callers instead of callees with --callers, and control how deep it traverses with --depth, to focus the call tree on exactly what you need.

Vibgrate Docs

Vibgrate Help

The default vg tree shows what a node calls. Two flags reshape it: --callers flips the direction to show what calls the node, and --depth controls how far the traversal goes. Together they let you focus the call tree precisely.

Prerequisites

Build the graph first:

vg build

Show callers instead of callees

By default vg tree walks callees (downstream dependencies). Add --callers to walk upstream — the chain of nodes that lead into the root:

vg tree --callers

This answers "who reaches this node, and through what?" — useful when you want to understand how a function is invoked rather than what it invokes.

Control depth

Deep trees can be overwhelming. Use --depth to bound how many levels the traversal descends:

vg tree --depth 2

A shallow depth gives you the immediate neighborhood; a larger depth reveals more of the chain. Start shallow and increase depth only as far as you need.

Combine the flags

The two flags compose. To see the callers up to a chosen depth:

vg tree --callers --depth 3

Choosing direction

  • Use the default (callees) to understand what a node depends on.
  • Use --callers to understand what depends on the node and how it is reached.

For a weighted, deterministic blast radius rather than a raw caller tree, reach for vg impact instead.

Tips

  • Keep depth modest for readability; widen it only to chase a specific chain.
  • Rebuild with vg build after code changes so the tree reflects current structure.

Related

See the main article on exploring the call tree with vg tree, and the impact analysis articles for change planning.