# Supported Export Formats in code-review-graph: GraphML, Neo4j Cypher, Obsidian, JSON, and SVG

> Explore supported export formats for code-review-graph including GraphML Neo4j Cypher Obsidian JSON and SVG. Easily visualize and analyze your code review data.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: api-reference
- Published: 2026-07-30

---

**The `code-review-graph` tool supports five export formats: JSON, GraphML, Neo4j Cypher, Obsidian vault, and SVG, each implemented as dedicated functions in the [`exports.py`](https://github.com/tirth8205/code-review-graph/blob/main/exports.py) module.**

The `code_review_graph` package provides a robust **exports module** designed to serialize internal graph data for consumption by external tools and visualization platforms. Located at [`code_review_graph/exports.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/exports.py), this module exposes specialized functions that convert the in-memory `GraphStore` into industry-standard formats. Whether you need machine-readable data interchange, graph database imports, or human-readable documentation, the library covers the full workflow from code analysis to artifact generation.

## Overview of the Exports Architecture

All export functionality resides in [`code_review_graph/exports.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/exports.py) [[exports.py#L1]], which defines a collection of `export_*` functions. Each function accepts a `GraphStore` instance (defined in [`code_review_graph/graph.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/graph.py)) and a target `Path` object, writing the serialized representation to disk. The command-line interface in [`code_review_graph/cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/cli.py) wires these functions to CLI flags, dispatching calls at lines 1889–1893 based on user input [[cli.py#L1889-L1893]].

## JSON Export

**`export_json`** writes the complete graph payload as a UTF-8 encoded JSON file, preserving file paths, metadata, and relationships without loss of fidelity.

This format serves as the canonical data interchange representation, suitable for downstream processing by scripts or archival storage. The implementation flattens the `GraphStore` internal structure into a dictionary and uses Python’s standard `json` module for serialization [[exports.py#L23-L31]].

```python
from pathlib import Path
from code_review_graph.graph import GraphStore
from code_review_graph.exports import export_json

store = GraphStore()

# ... populate store via code review analysis ...

export_json(store, Path("review_data.json"))

```

## GraphML Export

**`export_graphml`** generates an XML document compatible with graph visualization tools such as Gephi, yEd, and Cytoscape.

The function constructs a GraphML 1.0 compliant structure that encodes nodes as files/classes and edges as relationships. This format preserves layout hints and attribute data, making it ideal for visual exploration of code dependencies [[exports.py#L58-L66]].

```python
from code_review_graph.exports import export_graphml

export_graphml(store, Path("dependencies.graphml"))

```

## Neo4j Cypher Export

**`export_neo4j_cypher`** produces executable Cypher statements for importing the graph into a Neo4j graph database.

Rather than writing a binary file, this function generates a `.cypher` text file containing `CREATE` statements for nodes and relationships. You can execute the output directly in the Neo4j Browser or via `cypher-shell` to populate a database with the code review graph schema [[exports.py#L124-L132]].

```python
from code_review_graph.exports import export_neo4j_cypher

export_neo4j_cypher(store, Path("import_script.cypher"))

```

## Obsidian Vault Export

**`export_obsidian_vault`** creates a directory structure suitable for opening as an Obsidian.md knowledge base.

This function generates Markdown files with YAML frontmatter and wikilinks, creating individual notes for code entities alongside community overview documents and a master index. The output is a portable vault that maintains navigable relationships between components [[exports.py#L95-L103]].

```bash
code-review-graph --obsidian /path/to/vault

```

## SVG Visualization Export

**`export_svg`** renders a static vector graphic visualization using Matplotlib and NetworkX (optional dependencies).

This format produces a `.svg` file suitable for embedding in reports or documentation. The function handles figure sizing and layout automatically, converting the NetworkX representation into a publication-quality vector image [[exports.py#L57-L60]][[exports.py#L63-L71]].

```python
from code_review_graph.exports import export_svg

export_svg(store, Path("architecture.svg"))

```

## Command-Line Interface Integration

The CLI exposes each export format via dedicated flags. When a user specifies `--graphml`, `--neo4j`, `--obsidian`, or `--svg`, the parser imports the corresponding function from [`exports.py`](https://github.com/tirth8205/code-review-graph/blob/main/exports.py) and passes the current `GraphStore` and target path [[cli.py#L1889-L1893]].

```bash

# Generate GraphML for network analysis

code-review-graph --graphml output.graphml

# Create Neo4j import script

code-review-graph --neo4j import.cypher

# Build Obsidian vault

code-review-graph --obsidian ./my_vault

# Export SVG snapshot

code-review-graph --svg visualization.svg

```

## Summary

- **[`code_review_graph/exports.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/exports.py)** implements five distinct export strategies: JSON, GraphML, Neo4j Cypher, Obsidian vault, and SVG.
- **JSON** provides lossless data serialization for programmatic workflows.
- **GraphML** ensures compatibility with desktop visualization tools like Gephi and Cytoscape.
- **Neo4j Cypher** generates executable database import scripts.
- **Obsidian** produces navigable Markdown vaults with wikilinks and frontmatter.
- **SVG** creates static vector graphics via Matplotlib/NetworkX integration.
- The **CLI** in [`cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/cli.py) provides one-flag access to all formats, dispatching to the appropriate `export_*` function.

## Frequently Asked Questions

### How do I export to multiple formats in a single run?

You can invoke multiple export flags simultaneously in the CLI. The tool processes each export sequentially, writing separate files for each requested format. For example: `code-review-graph --json output.json --graphml output.graphml` generates both files from the same analysis pass.

### Does the SVG export require additional dependencies?

Yes. The `export_svg` function requires **Matplotlib** and **NetworkX** to be installed, as these libraries handle the graph layout and vector rendering. These are not installed by default with base `code-review-graph` and must be added to your environment if you intend to generate SVG visualizations [[exports.py#L57-L60]].

### Can I customize the Cypher output for a specific Neo4j version?

The `export_neo4j_cypher` function generates standard Cypher syntax compatible with Neo4j 4.x and 5.x. If you require version-specific optimizations or constraint definitions, you would need to post-process the generated `.cypher` file, as the module currently outputs portable `CREATE` statements without version-specific syntax variants [[exports.py#L124-L132]].

### Is the Obsidian export suitable for large codebases?

The `export_obsidian_vault` function creates one Markdown file per graph node, which works well for moderately sized projects. For extremely large codebases (thousands of files), the vault may become cumbersome to navigate, though the generated index and community overview files help organize the structure [[exports.py#L95-L103]].