Inspiration
While learning GraphRAG from a research paper, I spent hours chasing references by hand to find the papers that mattered. Search tools list papers, but they rarely show how papers connect. I wanted a tool that suggests what to read next and shows its evidence, for both people and AI agents.
What it does
PaperGraph takes a paper and finds its closest relatives in a citation graph of 2,341 real papers in graph machine learning, knowledge graphs and graph-based retrieval. Each suggestion comes with three clues you can inspect:
- Shared references: both papers cite the same earlier work
- Co-citation: later papers cite both of them together
- Topic similarity: their titles and topics are close in meaning
Results that the citation graph found, rather than text similarity, are marked "Found by graph", and every suggestion lists the actual shared references and co-citing papers behind it.
It also finds the shortest citation path between two papers (in either direction), shows an author's papers and co-authors, ranks key papers by topic, and draws each paper's neighbourhood as an interactive graph.
AI agents can query the same graph read-only through Relate's MCP server, for example to check whether one paper really cites another instead of guessing.
How I built it
- Data: a one-time script pulls 30 seed papers from OpenAlex (CC0), plus their references and their most-cited citing papers: 2,341 papers, 8,123 authors and 30,983 citation links.
- Embeddings: a small local model (all-MiniLM-L6-v2) turns each title and topic into a vector, computed once during ingestion.
- Storage: everything lives in one Relate file (
data/papergraph.rl), with constraints, a title index and a native vector index. - Backend: FastAPI with one dedicated worker thread holding a read-only Relate connection, since Relate connections belong to the thread that opened them. Every query is parameterized Cypher, and there's no raw-query endpoint.
- Scoring: candidates come from the union of vector search, bibliographic coupling and co-citation. Coupling and co-citation use Salton's cosine, so large surveys don't appear related to everything.
- Agent access:
relate serve --mcp stdio --read-only, exposingget_schemaandread_cypher, tested running alongside the app. - Frontend: plain HTML, CSS and JavaScript with Cytoscape.js stored locally, so the app runs fully offline in light or dark mode.
- Tests: 43 automated tests covering queries, scoring and every API endpoint. Most queries return in milliseconds; related-paper scoring takes about 240 ms (median).
Challenges
- Messy real data: OpenAlex had 25 duplicate paper records, which I merged. One seed paper was filed under the wrong title, so I dropped it rather than edit data by hand.
- Incomplete citations: some known citations are missing from OpenAlex (its record for GAT doesn't list GCN). I kept only real data and documented the gap instead of inventing links.
- Citation direction: paths first searched only one way. Searching both directions turned a misleading 6-step chain into the real direct link: LightRAG cites GraphRAG.
- Fair scoring: large surveys looked related to everything until I normalized the citation signals.
What I learned
Combining graph signals with vector similarity finds papers that text matching alone misses, and showing the evidence makes the suggestions trustworthy. I also learned to treat real-world data carefully: verify it, deduplicate it, and document the gaps rather than hide them.
What's next
Letting users choose their own seed papers to build a graph for any field, and an agent workflow that drafts an annotated reading list from the graph.
AI disclosure
Built with help from Claude Code for implementation, testing and documentation. All data comes from OpenAlex through the scripts in the repo; no paper data was written by hand.
Built With
- claude
- javascript
- mcp
- python
- relate