Other Formats
Additional graph format converters for specialized use cases.JSON Graph Format (JGF)
JGF is a standardized JSON format for representing graphs.Import
Example
Features
- ✅ Compound graphs (via
parentIdin metadata) - ✅ Visual properties (position, size, color in metadata)
- ✅ Custom data preservation
- ✅ No dependencies
Type Definitions
GML (Graph Modelling Language)
Text-based format with simple key-value syntax.Import
Example
Features
- ✅ Compound graphs (nested node syntax)
- ✅ Graphics properties (x, y, width, height)
- ✅ Custom data (JSON-serialized)
- ✅ No dependencies
- ✅ Human-readable format
Graphics Block
Visual properties are stored in agraphics block:
| Property | GML Key |
|---|---|
node.x | graphics { x ... } |
node.y | graphics { y ... } |
node.width | graphics { w ... } |
node.height | graphics { h ... } |
TGF (Trivial Graph Format)
Minimalist format: nodes, separator, edges.Import
Example
Format Specification
- Node section:
id [label](one per line) - Separator:
#on its own line - Edge section:
source target [label](one per line)
Features
- ❌ No compound graphs
- ❌ No visual properties
- ✅ Extremely simple format
- ✅ No dependencies
- ✅ Easy to hand-write
Edge List
Simplest format: array of[source, target] tuples.
Import
Example
Parsing
Type Signature
Features
- ❌ No node metadata
- ❌ No edge metadata
- ❌ No compound graphs
- ✅ Minimal format
- ✅ No dependencies
Adjacency List
Object mapping node IDs to arrays of neighbor IDs.Import
Example
Undirected Graphs
Parsing
Type Signature
Features
- ❌ No node metadata
- ❌ No edge metadata
- ❌ No compound graphs
- ✅ Compact representation
- ✅ No dependencies
- ✅ Natural for algorithms
XYFlow (React Flow / Svelte Flow)
Format for React Flow and Svelte Flow.Installation
Requires the@xyflow/system peer dependency:
Import
Example
Features
- ✅ Compound graphs (via
parentId) - ✅ Required position and size
- ✅ Custom data
- ✅ Node types (mapped to
shape)
Mapping
| Graph Property | XYFlow Property | Notes |
|---|---|---|
node.id | id | Required |
node.x, node.y | position: { x, y } | Required |
node.width, node.height | width, height | Dimensions |
node.shape | type | Node type |
node.parentId | parentId | Parent node |
node.data | data | Custom data |
edge.label | data.label | Stored in data |
Usage with React Flow
Type Definitions
Format Comparison
| Format | Type | Metadata | Compound | Dependencies |
|---|---|---|---|---|
| JGF | JSON | ✅ Full | ✅ Yes | None |
| GML | Text | ✅ Full | ✅ Nested | None |
| TGF | Text | ⚠️ Labels only | ❌ No | None |
| Edge List | Array | ❌ None | ❌ No | None |
| Adjacency List | Object | ❌ None | ❌ No | None |
| XYFlow | JSON | ✅ Full | ✅ Yes | @xyflow/system |
Use Cases
JGF
- Interoperability with other tools
- Full graph data preservation
- Web APIs and data exchange
GML
- yEd graph editor
- Human-readable storage
- Version control friendly
TGF
- Quick prototyping
- Hand-written graphs
- Educational examples
Edge List
- Algorithm input
- Network analysis
- Large sparse graphs
Adjacency List
- Traversal algorithms
- Graph algorithms textbooks
- Performance-critical code
XYFlow
- React Flow applications
- Svelte Flow applications
- Interactive graph editors
See Also
- Format Overview - All format converters
- Cytoscape.js - Another JSON visualization format
- D3.js - Force-directed JSON format