# Paper Graph (/docs/core-concepts/graph)



The **Paper Graph** is how Paperful represents what's inside a paper. Instead of one large block of extracted text, a processed paper becomes an ordered sequence of **nodes**. Each node is a title, paragraph, table, image, formula or other element, and it remembers where it came from in the original document.

<Mermaid
  chart="
flowchart LR
A[&#x22;Title&#x22;] --> B[&#x22;Paragraph&#x22;] --> C[&#x22;Section Title&#x22;] --> D[&#x22;Image&#x22;] --> E[&#x22;Table&#x22;] --> F[&#x22;...&#x22;]
"
/>

The graph is useful whenever you need more than plain text:

* **Search and RAG:** go from a search hit to the exact part of a document, and the content around it.
* **Citations:** link an answer back to a page and region of the original document.
* **Document viewers:** show, highlight or style content based on what it is.
* **Extraction:** pull out only the tables, headings or references.

If you only need a document's text, Markdown is simpler. Paperful generates Markdown from the graph, so both always describe the same content.

## Why a graph [#why-a-graph]

Flattening a document into text loses its structure:

```text
2026 Annual Report
Revenue increased by 24%.
Regional Performance
North America
$12.4M
Europe
$8.7M
```

From the text alone, you can't tell which lines are headings, paragraphs or table cells. The graph keeps that information:

<Mermaid
  chart="
flowchart TD
A[&#x22;<b>Document title</b><br/>2026 Annual Report&#x22;]
A --> B[&#x22;<b>Text</b><br/>Revenue increased by 24%.&#x22;]
B --> C[&#x22;<b>Section title</b><br/>Regional Performance&#x22;]
C --> D[&#x22;<b>Table</b><br/>Regional revenue&#x22;]
"
/>

Applications can then treat the paper as a document, not just a sequence of characters.

## Reading order [#reading-order]

Nodes are arranged in the order a person would read the document. Multi-column layouts, figures and footnotes are placed where they belong in that flow, rather than strictly top to bottom.

Reading order is separate from pages. A section that starts at the bottom of one page and continues on the next is still one continuous run of nodes, while each node still remembers which page it appeared on.

```text
Page 1   1 → Document title
         2 → Text
         3 → Text
Page 2   4 → Section title
         5 → Text
         6 → Table
```

Reading order lets you move through a document naturally. Pages let you point back to the source.

## Navigating the graph [#navigating-the-graph]

Because nodes are ordered, you can start from any node and [move to the ones before and after it](/docs/sdks/papers/graph#move-between-nodes). You can also ask for a node's [**context**](/docs/sdks/papers/context): the nodes immediately around it, in a single step.

This means you rarely need to load a whole paper. Load the part you care about, then expand outward only as far as you need.

## From search to context [#from-search-to-context]

[Search](/docs/sdks/search/query) results point directly into the graph. Each result tells you which nodes matched and which pages they're on.

That makes a simple pattern for RAG and agents possible:

<Mermaid
  chart="
flowchart LR
A[&#x22;Question&#x22;] --> B[&#x22;Search&#x22;] --> C[&#x22;Matching nodes&#x22;] --> D[&#x22;Surrounding nodes&#x22;] --> E[&#x22;Model&#x22;]
"
/>

1. Search for content relevant to the question.
2. Find the nodes that matched.
3. Add the nodes around them for context.
4. Give that focused, structured context to the model.

See [Search to context](/docs/sdks/search/context) for a working example.

Because every node keeps its page and position on the page, the model's answer can be traced back to the exact place in the original document.
