Guides

Graph analytics: when the relationships are the answer.

Row-based analytics answers questions about values: totals, averages, trends over time. Graph analytics answers questions about connections: which accounts share a device, which products are bought together, which suppliers a delayed shipment cascades through. Both matter — but only one of them is easy in a row-oriented store.

Graph analytics is the practice of analyzing data through its relationships — traversing connections between records to answer questions like "what is linked to this?" and "what happens downstream?" — rather than aggregating isolated rows.

What this guide covers

The practical decision points.

A different question shape

Aggregations ask "how much?" Graph analytics asks "what is connected to what?" — and many operational questions are secretly the second kind.

The same pattern across domains

Fraud rings, customer 360 views, supply chain dependencies, and agent reasoning all reduce to traversing typed relationships between records.

Both in one query

RushDB combines relationship traversal with select, groupBy, and time buckets, so a connection query and an aggregation run against the same records.

Architecture sketch

Rows answer values. Graphs answer connections.

The same underlying records support two kinds of questions. Aggregation collapses records into numbers; traversal follows relationships outward from a starting record to whatever is connected.

Implementation example

One query, both shapes: aggregate and traverse

The first query is classic analytics — orders grouped by day. The second is graph analytics — accounts connected to a flagged account through a shared device. Same backend, same records, same SearchQuery contract.

from rushdb import RushDB

db = RushDB('RUSHDB_API_KEY')

# Aggregation: row-style analytics
daily_orders = db.records.find({
    'labels': ['ORDER'],
    'aggregate': {
        'total': {'fn': 'sum', 'field': 'totalUsd'},
    },
})

# Traversal: graph analytics
connected_accounts = db.records.find({
    'labels': ['ACCOUNT'],
    'where': {
        'DEVICE': {
            'ACCOUNT': {'flagged': True}
        }
    },
})

Why this matters for AI agents

Vector retrieval gives an agent text that sounds similar to its question. Graph analytics gives it the connected records that explain the match: the account behind a transaction, the citation behind a claim, the incident behind a metric drop. Agents that can traverse relationships reason over evidence instead of assembling context from isolated fragments — the difference between retrieving and understanding.

The enterprise knowledge graph angle

Organizational data — documents, systems, operational records — becomes analyzable as a knowledge graph once relationships are explicit. RushDB builds that structure at ingest: nested JSON becomes linked records automatically, and cross-source relationships are proposed for review rather than guessed. That makes knowledge-graph analytics a byproduct of writing data, not a months-long ontology project.

Decision table

Graph analytics vs row-based analytics

These are complements, not competitors. The question is which one your query is secretly asking — and whether your backend forces you to fake one with the other.

Topic
Row-based analytics (SQL/BI)
Graph analytics
Core question

How much, how many, how fast — values aggregated across rows.

What is connected to what — relationships traversed between records.

Fraud example

Count of flagged transactions per day. Useful, but blind to the ring behind them.

Accounts sharing a device or beneficiary with a flagged account — the ring itself.

Cost of the "other" question

Connection questions become chains of self-joins that grow with each hop.

Aggregations run over traversal results with select and groupBy in the same query.

For AI agents

An agent gets numbers without the context that explains them.

An agent can follow relationships from a match to its evidence — reasoning over connections, not just retrieving similar text.