Skip to main content

File Formats

The system supports two text-based graph file formats. Both the WASM browser parser and the Rust backend parser implement identical parsing logic, ensuring consistent results between client-side preview and server-side algorithm execution.

Edge List

The most common format. Each line describes one directed edge.

Syntax: source target [weight]

# comment lines are ignored
% so are lines starting with %
0 1 2.5
0 2 1.0
1 3 1.5
2 3 0.5
3 4 2.0

Rules:

  • Fields are whitespace-separated (spaces or tabs)
  • Weight is optional — defaults to 1.0 if absent
  • Lines starting with # or % are skipped (common in SNAP dataset files)
  • Node IDs are integers (can be large and sparse — e.g., 0, 100, 999999)
  • Directed edges: 0 1 means edge from 0 to 1 only

Minimal example (unweighted):

0 1
1 2
2 3
3 0

SNAP-compatible:

The edge list format is compatible with Stanford SNAP datasets. Most SNAP files can be uploaded directly.


Adjacency List

Each line describes one node and all of its outgoing neighbors.

Syntax: node: neighbor1[,weight1] neighbor2[,weight2] ...

0: 1,2.5 2,1.0
1: 3,1.5
2: 3,0.5
3: 4,2.0

Rules:

  • Node ID followed by colon, then space-separated neighbor entries
  • Each neighbor entry is neighborId or neighborId,weight
  • Weight defaults to 1.0 if omitted
  • Lines starting with # or % are skipped
  • Nodes with no outgoing edges can be listed with an empty neighbor list: 5:

Display Limits

The browser WASM parser supports up to 3,000 display nodes for performance. If a file contains more:

  • The first 3,000 unique nodes encountered are rendered
  • Remaining nodes are counted but not displayed
  • The truncated: true flag is set in the parsed result
  • Server-side algorithm execution still processes all nodes regardless of display limit

Large File Tips

For graphs with hundreds of thousands of edges:

  1. Edge list is faster to parse — simpler format, fewer string operations
  2. WASM parsing is ~10× faster than JavaScript — 100K edges parses in ~80ms
  3. Reduce to 3K nodes — pre-filter your graph to stay under the display limit for best visualization
  4. Algorithm execution has no size limit — the backend processes the full graph regardless

Format Detection

The frontend does not auto-detect format — you must select "Edge List" or "Adjacency List" in the UI. Sending the wrong format to the API returns a parse error.


Sample Files

Minimal directed graph (edge list):

0 1
1 2
2 3
3 1

This graph has an SCC: nodes 1, 2, 3 are strongly connected.

Weighted DAG (edge list):

0 1 1.0
0 2 4.0
1 2 2.0
1 3 5.0
2 3 1.0

Dijkstra from node 0: shortest path to node 3 is 0 → 1 → 2 → 3 with total weight 4.0.

Adjacency list equivalent:

0: 1,1.0 2,4.0
1: 2,2.0 3,5.0
2: 3,1.0