# Xref Graph

{% hint style="info" %}
Starting with IDA 9.2, the external *qwingraph* used to make graphs has been replaced with our native and interactive graphing tool, **Xref Graph**.
{% endhint %}

The integrated **Xref Graph** visualizes cross-reference relationships between code and data elements in a binary through an interactive interface. Xref Graph is available right out of the box via **View → Graphs → Xrefs to|from** and **View → Graphs → Manage...**.

## Core Features

* Interactive graph visualization of cross-references
* Multiple node types (code, data, imports) with distinct visual styling
* Filtering options to focus your analysis
* Force-directed layout with interactive adjustment
* Multiple savable graphs per database
* Fully supported dark theme

{% hint style="success" %}
**How to use Xref Graph**

Check our [blog post](https://hex-rays.com/blog/mapping-relationships-in-ida-9.2-dynamic-xref-graph-and-xref-tree) that introduces the new Xref Graph alongside the Xref Tree, and demonstrates a typical workflow with practical usage tips.
{% endhint %}

## Xref Graph Basic Controls

* **Move nodes around**: Click and drag a selected node
* **Pan**: Click and drag graph background to move the whole graph. Hold <kbd>Shift</kbd> while dragging to pan without accidentally selecting and moving nodes.
* **Zoom**: Hold <kbd>Ctrl</kbd>/<kbd>CMD</kbd> while scrolling to zoom in/out
* **Jump to address**: Double-click a node to navigate to the corresponding item in the IDA View
* **Layout**: Use the <kbd>Space</kbd> key to pause or resume the layout mechanism

### Adding and Removing Nodes

You can add or remove nodes from the graph using the right-click context menu on a node, or by using the following shortcuts with one or more nodes selected:

* Press `A` to add all cross-referenced nodes (**A**ll Xrefs)
* Press `F` to add nodes referenced by the selected nodes (Xrefs **F**rom)
* Press `T` to add nodes that reference the selected nodes (Xrefs **T**o)
* Press `X` to open a chooser dialog for selecting specific cross-references (**X**ref from or to)
* Press `D` to delete the selected nodes (**D**elete)
* Press `P` to pin the node in place

### Components of the main graph view

#### Nodes

Nodes represent code, data, or import elements and are color-coded:

* **Blue**: Code (functions, instructions)
* **Green**: Data (variables, structures)
* **Pink**: Imports (external references)

Each node displays the name of the element it represents.

#### Information Display

* **Node information**: Hover over a node to see details in the top-left corner: name, address, type, and cross-reference counts
* **Edge information**: Hover over an edge to see source, destination, and reference type details

## Fit to viewport

The Fit to viewport option adjusts the view to optimally display content:

* `W` (Now) — Fits selected nodes to the viewer; if no nodes are selected, it fits the entire graph.
* `Shift-W` (Always) — Enables continuous fitting to the viewer.

## Overlay elements

### Minimap

Press `M` to toggle the minimap, which shows an overview of the entire graph and helps with navigation in large graphs. The minimap highlights the current viewport area for easy orientation.

### Search Bar

Press `S` to toggle the Search Bar and Layout button to improve visibility.

### Options Panel

Press `O` to toggle the options panel, which includes:

#### Filters

The filters section allows you to control which elements are displayed:

* **Node name filter** - Filter nodes by name
* **Filter orphan nodes** - Hide nodes with no visible connections
* **Edge type filters** - Show/hide specific edge types (Read, Write, Offset, Code)
* **Node type filters** - Show/hide specific node types (Code, Data, Import)

The number of filtered (hidden) nodes is displayed at the top of the filter panel.

#### Layout Configuration

The force-directed graph layout can be customized with the following parameters:

* **Drag** - Controls how quickly node movement slows down (damping)
* **Gravity** - Pulls nodes toward the center of the graph
* **Repulsion** - Controls how strongly nodes push each other away
* **Spring strength** - Determines how rigidly the edges hold nodes together
* **Spring length** - Sets the preferred distance between connected nodes
* **Minimum velocity** - Threshold below which node movement stops
* **Maximum velocity** - Caps the maximum speed of node movement
* **Node mass** - Base mass value for nodes (affects how easily they move)
* **Edge mass** - Base mass value for edges (affects how easily group of nodes move)
* **Timestep** - Controls the simulation speed
* **Theta threshold** - Performance parameter for the Barnes-Hut approximation

Click "Reset the layout parameters" to restore default values.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hex-rays.com/core/disassembler/concepts/xref-graph.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
