Start with two tables
A property graph needs nodes and relationships. In a lakehouse, those are ordinary tables:
CREATE DELTA TABLE customers (
id BIGINT,
name STRING,
region STRING,
industry STRING
);
CREATE DELTA TABLE referrals (
id BIGINT,
src BIGINT,
dst BIGINT,
weight DOUBLE,
edge_type STRING
);
Declare the graph
DeltaForge maps the tables into a property graph. The declaration stores the mapping, not another copy of the data:
CREATE GRAPH customer_network
VERTEX TABLE customers
ID COLUMN id
NODE NAME COLUMN name
NODE TYPE COLUMN region
EDGE TABLE referrals
SOURCE COLUMN src
TARGET COLUMN dst
WEIGHT COLUMN weight
EDGE TYPE COLUMN edge_type
DIRECTED;
CREATE GRAPHCSR customer_network;
Query relationships with Cypher
Once declared, the graph can be queried with pattern matching:
USE customer_network
MATCH (customer)-[referral]->(referred)
WHERE referral.weight >= 0.5
RETURN customer.name,
referred.name,
referral.edge_type,
referral.weight
ORDER BY referral.weight DESC;
Run graph algorithms and join the result to SQL
Graph algorithms are most useful when their output can be combined with business data. This query calculates PageRank and joins the scores to customer attributes:
SELECT c.id,
c.name,
c.region,
scores.score AS influence_score
FROM cypher('customer_network', $$
CALL algo.pageRank({
dampingFactor: 0.85,
iterations: 20
})
YIELD node_id, score
RETURN node_id, score
$$) AS scores(node_id BIGINT, score DOUBLE)
JOIN customers c ON c.id = scores.node_id
ORDER BY influence_score DESC;
Update the graph with SQL
The graph does not introduce a second transaction model. Add and change relationships through the backing Delta table:
INSERT INTO referrals
VALUES (101, 12, 44, 0.8, 'partner');
UPDATE referrals
SET weight = 0.9
WHERE id = 101;
DELETE FROM referrals
WHERE id = 101;
When this approach fits
- Fraud rings and transaction networks.
- Customer, supplier, and referral relationships.
- Identity resolution and entity linking.
- Recommendation and similarity analysis.
- Community detection and influence scoring.
A dedicated graph database remains useful for high-volume transactional graph applications. A graph projection over Delta Lake fits analytical workloads where the data already lives in the lakehouse and copying it would create another system to operate.
FAQ
Can the source tables also be queried with SQL?
Yes. Graph and relational queries use the same Delta tables.
Can raw Parquet files be queried as a graph?
Yes, for read-only analysis. Use Delta tables when you need ACID updates, time travel, and graph mutations through SQL.
Which algorithms are available?
DeltaForge includes centrality, community detection, pathfinding, topology, similarity, and embedding algorithms. See graph analytics and the Louvain tutorial.
Run it yourself
Install DeltaForge and run the graph demos against your own object storage. Start with the install guide or the demo library.