🕸️ Graph Database

Lock-free graph database for relationships and traversals. 40× faster than Neo4j.

API Endpoint

api.44s.io:9003

HTTP REST API

Concepts

ConceptDescription
NodeAn entity with labels and properties
EdgeA relationship between two nodes with a type and properties
LabelCategory tag for nodes (e.g., "Person", "Company")
PathSequence of nodes connected by edges

Quick Start

Create Nodes

curl -X POST https://api.44s.io:9003/nodes \
  -H "Content-Type: application/json" \
  -H "X-API-Key: 44s_your_api_key" \
  -d '{
    "labels": ["Person"],
    "properties": {
      "name": "Alice",
      "age": 30,
      "email": "alice@example.com"
    }
  }'

# Response
{
  "id": "node_abc123",
  "labels": ["Person"],
  "properties": {"name": "Alice", "age": 30, "email": "alice@example.com"}
}

Create Edges (Relationships)

curl -X POST https://api.44s.io:9003/edges \
  -H "Content-Type: application/json" \
  -H "X-API-Key: 44s_your_api_key" \
  -d '{
    "from_id": "node_abc123",
    "to_id": "node_def456",
    "edge_type": "KNOWS",
    "properties": {
      "since": "2020-01-15",
      "relationship": "colleague"
    }
  }'

# Response
{
  "id": "edge_xyz789",
  "from_id": "node_abc123",
  "to_id": "node_def456",
  "edge_type": "KNOWS"
}

Find Neighbors

curl "https://api.44s.io:9003/nodes/node_abc123/neighbors" \
  -H "X-API-Key: 44s_your_api_key"

# Response
[
  {
    "node": {"id": "node_def456", "labels": ["Person"], "properties": {"name": "Bob"}},
    "edge": {"id": "edge_xyz789", "edge_type": "KNOWS", "properties": {"since": "2020-01-15"}}
  }
]

Find Shortest Path

curl "https://api.44s.io:9003/path?from=node_abc123&to=node_ghi012" \
  -H "X-API-Key: 44s_your_api_key"

# Response
{
  "nodes": [
    {"id": "node_abc123", "labels": ["Person"], "properties": {"name": "Alice"}},
    {"id": "node_def456", "labels": ["Person"], "properties": {"name": "Bob"}},
    {"id": "node_ghi012", "labels": ["Person"], "properties": {"name": "Charlie"}}
  ],
  "edges": [
    {"edge_type": "KNOWS", "properties": {}},
    {"edge_type": "KNOWS", "properties": {}}
  ]
}

Python Client

import requests

BASE_URL = "https://api.44s.io:9003"
HEADERS = {
    "Content-Type": "application/json",
    "X-API-Key": "44s_your_api_key"
}

class GraphClient:
    def create_node(self, labels: list, properties: dict):
        r = requests.post(f"{BASE_URL}/nodes", headers=HEADERS, json={
            "labels": labels,
            "properties": properties
        })
        return r.json()
    
    def create_edge(self, from_id: str, to_id: str, edge_type: str, properties: dict = None):
        r = requests.post(f"{BASE_URL}/edges", headers=HEADERS, json={
            "from_id": from_id,
            "to_id": to_id,
            "edge_type": edge_type,
            "properties": properties or {}
        })
        return r.json()
    
    def neighbors(self, node_id: str, edge_type: str = None):
        url = f"{BASE_URL}/nodes/{node_id}/neighbors"
        if edge_type:
            url += f"?edge_type={edge_type}"
        return requests.get(url, headers=HEADERS).json()
    
    def shortest_path(self, from_id: str, to_id: str):
        return requests.get(f"{BASE_URL}/path?from={from_id}&to={to_id}", headers=HEADERS).json()
    
    def bfs(self, start_id: str, max_depth: int = 3):
        return requests.get(f"{BASE_URL}/bfs?start={start_id}&depth={max_depth}", headers=HEADERS).json()

# Build a social graph
g = GraphClient()

alice = g.create_node(["Person"], {"name": "Alice", "role": "engineer"})
bob = g.create_node(["Person"], {"name": "Bob", "role": "designer"})
company = g.create_node(["Company"], {"name": "TechCorp", "industry": "tech"})

g.create_edge(alice["id"], bob["id"], "KNOWS")
g.create_edge(alice["id"], company["id"], "WORKS_AT")
g.create_edge(bob["id"], company["id"], "WORKS_AT")

# Find Alice's colleagues
colleagues = g.neighbors(alice["id"], edge_type="KNOWS")
for c in colleagues:
    print(f"Alice knows {c['node']['properties']['name']}")

API Reference

Nodes

POST /nodes

Create a node

GET /nodes/{id}

Get a node by ID

DELETE /nodes/{id}

Delete a node (and its edges)

GET /nodes/label/{label}

Find nodes by label

Edges

POST /edges

Create an edge between nodes

GET /nodes/{id}/neighbors

Get neighbors of a node

Traversals

GET /path?from={id}&to={id}

Find shortest path between nodes

GET /bfs?start={id}&depth={n}

Breadth-first search from a node

Use Cases

Social Network

# Friend recommendations (friends of friends)
def recommend_friends(user_id):
    friends = g.neighbors(user_id, "FRIENDS_WITH")
    friend_ids = set(f["node"]["id"] for f in friends)
    
    recommendations = {}
    for friend in friends:
        fof = g.neighbors(friend["node"]["id"], "FRIENDS_WITH")
        for potential in fof:
            pid = potential["node"]["id"]
            if pid != user_id and pid not in friend_ids:
                recommendations[pid] = recommendations.get(pid, 0) + 1
    
    return sorted(recommendations.items(), key=lambda x: x[1], reverse=True)

Knowledge Graph

# Build a knowledge graph
python = g.create_node(["Language"], {"name": "Python", "type": "programming"})
ml = g.create_node(["Topic"], {"name": "Machine Learning"})
tensorflow = g.create_node(["Framework"], {"name": "TensorFlow"})

g.create_edge(tensorflow["id"], python["id"], "WRITTEN_IN")
g.create_edge(tensorflow["id"], ml["id"], "USED_FOR")

# Query: "What can I use Python for?"
python_tools = g.neighbors(python["id"])
topics = set()
for tool in python_tools:
    for use in g.neighbors(tool["node"]["id"], "USED_FOR"):
        topics.add(use["node"]["properties"]["name"])

Performance

Metric44s GraphNeo4j
Single hop traversal<10μs~100-500μs
Shortest path (6 degrees)<1ms~10-50ms
Concurrent traversalsLinear scalingLock contention