Skip to main content
The GPU Layout Engine uses a simple WebSocket JSON protocol.

Start Layout

Request to start layout computation:
{
  "type": "start",
  "nodes": ["id1", "id2", "id3"],
  "edges": [
    {"source": "id1", "target": "id2"},
    {"source": "id2", "target": "id3"}
  ],
  "options": {
    "iterations": 1000,
    "gravity": 1.0,
    "scalingRatio": 2.0,
    "strongGravityMode": false,
    "edgeWeightInfluence": 1.0,
    "barnesHutTheta": 1.2
  }
}

Progress Update

Sent periodically during computation:
{
  "type": "progress",
  "iteration": 450,
  "total": 1000,
  "converged": false
}

Result

Final positions when computation completes:
{
  "type": "result",
  "positions": {
    "id1": [1.23, 4.56, 0.0],
    "id2": [2.34, 5.67, 0.0],
    "id3": [3.45, 6.78, 0.0]
  },
  "duration_ms": 2341
}

Cancel

Request to cancel running computation:
{
  "type": "cancel"
}

Error

Error response:
{
  "type": "error",
  "message": "GPU not available"
}

Configuration

Environment variables:
VariableDefaultDescription
GRAPHPU_HOST0.0.0.0Bind address
GRAPHPU_PORT9002WebSocket port
GRAPHPU_LOGinfoLog level