Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Euler meets codd
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Euler meets Codd

Source: Neo4j Graph Intelligence Platform•November 16, 2026 at 04:56 PM

Euler meets Codd

Neo4j Virtual Graph lets you query relational data in Databricks, Snowflake, BigQuery and similar platforms with Cypher/GQL, using Neo4j’s full suite of graph tools.

Querying your relational data with graph queries

The dawn is dark and misty, dimly illuminated by oil lamps, as Leonhard Euler treads the cobblestones in the Prussian city of Königsberg. The autumn wind makes the rain sting his face and it is considerably colder than he remembers it being in Riehen, Switzerland, where he grew up. The year is 1737 and it’s been a year since he solved the famous puzzle of this city. He has come here now to walk across the seven bridges himself. Just as he steps onto the first bridge, a strangely dressed man approaches him and they both stop.

“You are Leonhard Euler,” says the stranger. “One of the greatest mathematicians of all time.”

“Well, thank you,” Euler replies with a bow. “And who might you be?”

“I am Edgar Codd and I come from the future. You have just invented graph theory, and you can’t imagine the impact it will have on the world I come from, more than two centuries from now. I hope to have the same impact with the invention I have recently made.”

A gust of wind blows in from the cold waters of the Pregel River, causing them both to pull their coats tighter around themselves. Euler looks curiously at Codd, waiting for him to continue.

“I have invented the relational model,” continues Codd, “the ideal way to store large amounts of data in a structured way. Your invention is the ideal way to run algorithms and find answers in large datasets, while my invention is the ideal way to store the data.”

Suddenly, a third figure appears in the shadows behind Codd on the bridge. He lays his hand on Codd’s shoulder and says, with a very, very slight Swedish accent: “Well, actually…”

The relational data model and the graph data model are functionally equal; what you can model in one you can model in the other. Where they differ is in what they are good at and which types of problems they handle efficiently.

Graph use cases do not have to be mathematically complex. Often, the advantage comes from how connected the data is and how those connections need to be queried. If there are a lot of connections between the data elements, and you need to traverse those when querying the data, there may be an advantage in storing the data as a graph instead of as a table. The possibility of easily running graph algorithms on top of that data is an added bonus.

There are three main reasons why a graph database is better in queries over highly connected data, two softer reasons and one harder:

  • Graph query languages are better at expressing those types of queries
  • The visual graph is better at showing and modelling that type of data
  • It is faster at traversing those connections, because of how the data is stored (so-called index-free adjacency)

A lot of the data in the world is, however, not stored as a graph, but in a traditional relational database. And the relational model is ideal for many use cases, but that is not the only reason for its widespread use. Relational databases have been widely adopted for decades, and the large data warehouses like BigQuery, Snowflake and Databricks are all based on this traditional model.

Fortunately, we can bring the first two benefits to relational data too, even if we do not get the traversal performance of a native graph.

Virtual Graph

Following a preview release this summer, Neo4j Virtual Graphs became generally available in Aura this November (2026). The launch brought a range of new features, including support for Quantified Path Patterns (variable-length patterns), which we will make use of here.

Virtual Graphs allow you to create a virtual Neo4j instance that acts as a wrapper over a relational data store such as Databricks, Snowflake or BigQuery, and lets you run Cypher queries, use Aura Graph Analytics, and explore the data as a graph with Neo4j tools. And this is done with zero ETL; the data remains in the relational data store.

This is for those who have a lot of data in such a data store and want to run graph analytics without having to copy all those petabytes of data over to Neo4j. This allows you to take advantage of graph queries, graph algorithms and graph visualisations, but you will not get the performance of a native graph. But in many cases that may not be needed, at least not for initial experimentation.

Let us look at a typical graph use case, fraud detection, and how that would work with Virtual Graphs. Our example is relatively small, with only 10,000 accounts and about 100,000 transactions, but it will show the concept.

Data model and use case

We will use a classic fraud-detection example where we try to find transaction fraud rings. I have the same data modelled both as a graph in Neo4j and as relational data in Databricks.

Transaction fraud rings are potential money-laundering schemes where someone transfers money to another account, which in turn forwards the money to a third account (while retaining a portion as commission) and so on for a number of hops before the laundered money returns to the original account.

So we want to find any pattern where money is sent around and returns to the original account (i.e. a “ring”), but only where the transactions occur in chronological order and where each subsequent transaction carries a smaller amount (within a limit) than the previous one.

Here is an example of a fraud ring started by Ezekiel and funnelled through Binky and Vivianna.

Native Neo4j Fraud detection

Let’s start by doing this with a native Neo4j instance. A typical fraud ring detection query looks like this:

It finds a ring of transactions from one account, back to the same account, visiting at least one other account and where the consecutive transactions are later in time, smaller in amount and greater than 80% of the previous amount.

One thing this query does not look for is node uniqueness, i.e. whether we revisit the same account multiple times. There is a path mode called ACYCLIC that guarantees node uniqueness, but that doesn’t work for us since we need to return to the start node. A path mode called SIMPLE, which would do exactly that, has been discussed but is not yet planned. There are other ways to solve this, but we will instead keep the query simple. The only downside is that we may get the same transaction rings repeated. If we have two rings that overlap (the same account is involved) and the overlaps match in time, we would get them both as individual rings and as a bigger, figure-eight-shaped, ring.

This is the result of the query above on the dataset described earlier. Running this took around 4 seconds on my native graph.

As you can see there are 8 smaller rings and one really huge ring (going through 100 different bank accounts). Such unbounded variable-length queries are currently not supported for virtual graphs, only for native graphs, so we need to settle on an upper boundary for our query. For now, let’s set the upper bound to 10 (which means the pattern within parentheses can repeat up to 10 times, i.e. yield up to 11 transactions):

This one takes 1.5 seconds and yields just the 8 smaller rings:

We can also view the result like this, which suits fraud rings quite well:

Virtual Graph Fraud detection

As alluded to earlier, we can use Virtual Graph to run that last Cypher query and get the graph visuals on top of Databricks. Let’s set up a Virtual Graph instance and connect it to the Databricks instance we mentioned above.

Start by logging in to your Aura account (you can register an account for free here, but Virtual Graph is a paid feature that will require you to register your credit card). Then go to Instances and click + New and select Virtual graph.

Give your Virtual Graph a name, select a cloud provider and region and choose a memory size. The memory size matters depending on how much processing needs to take place on the Neo4j side. As much as possible will be pushed down to the remote database so that the resulting rows are just streamed back through Neo4j (not requiring much memory), but in case large aggregations need to happen on the Neo4j side you may require more RAM. It is very hard to give advice on when that would happen, so I would recommend starting with the smallest instance and scaling up if needed. This example here works well on the smallest instance.

Click Add new data source and select Databricks as your provider in the next dialog. This brings you to a form where you enter your connection details. You will need an access token with SQL access, created through your Databricks account, and then you fill in the form like this and press Next:

If you already have a data source set up for your provider and database you can of course select that instead of creating a new one.

After confirming that it could connect to your data source, and what tables it found there, you will get back to the Virtual Graph dialog. Press Next.

On the next screen choose to create a new model (unless you already have models set up for this data source), and then after that you can choose between defining it manually from scratch, generating it from the schema or generating it with AI. Let’s start by generating it from the schema and then modify that to fit our needs.

It now proposes a schema, i.e. a mapping, from relational to graph, based on the tables in our data source. It resembles what we want, but not exactly:

The one we had for our native graph looked like this, if you remember:

The first thing to change is the node labels. In relational databases, tables are usually given plural names, while graph labels are given singular names. And to follow the naming standard of Neo4j we’ll capitalise the first letter. Just double-click the nodes to change the name.

Now we need to change the type of the relationship to either TO or FROM, but which one? If we click it we see that it is the to_id column that is mapped to this relationship, so let’s name it TO.

But we also need the other relationship, i.e. FROM. To create that we hover over the edge of the Transaction node, click and drag to get a relationship, and by dropping it over the Account node we connect the two (instead of creating a new node as well).

Give it the name FROM and select the transactions table and also the id and from_id columns in the drop-downs.

And now we have a schema that looks like the one we had above. The column names are the same as our node properties in the native graph schema, so no need to change those (but we could if we wanted to).

Now we can click Create Virtual Graph to start our instance. Once our new instance has started it can be used in the Aura console just like any other instance, except that we find it under VIRTUAL instead of AURA or SELF-MANAGED. We can connect using Query, Bloom, Dashboards, etc. just like we can with other instances. So let’s connect with Query and run the same query that we ran on our native graph.

Lo and behold, it works: we get the same fraud rings that we detected with the bounded query on the native graph. It took 25 seconds compared to 1.5 seconds on the native graph, but an analytical use case like this does not require an instant response. That response time would matter much more if, for example, you were displaying someone’s degree of connection to you on LinkedIn, but detecting fraud in a big dataset can run for some time.

It should be noted that this is not a scientific benchmark. It is hard to deduce how much compute (CPU count and amount of RAM) Databricks used to run the query, but the Neo4j native tests ran with the smallest possible Aura instance with just 1 CPU and 1 GB of RAM.

What we can say is that out of the three graph benefits defined at the beginning of this article, the native graph is still a lot faster with graphy queries, but with virtual graphs we do see the benefits of better visual output/modelling and more manageable queries. Don’t believe me about the queries? Well, this is the SQL variant that Virtual Graph generated for that Cypher query:

Conclusion

With millions of transactions instead of a hundred thousand it will of course take a lot longer, but an analytical query like this can run overnight and the next morning you may have the result.

And once you need better performance and are ready for the next step, just spin up a native graph instance and import the data. And you know what? Virtual Graph and Data Importer share the same data sources and graph models. To run a full import, just go to Import, select the data source and model we defined earlier, and start the import into your new instance. You can continue using your Virtual Graph while the import runs.

Euler meets Codd was originally published in Neo4j Developer Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.

← All articles

What this article says

More in Software Development

All →
Ansys LS-DYNA Runs Faster on the NVIDIA Vera CPU
Ansys

Ansys LS-DYNA Runs Faster on the NVIDIA Vera CPU

SC26: IBM shows progress in bringing quantum & HPC together
IBM

SC26: IBM shows progress in bringing quantum & HPC together

IBM, AMD advance quantum error correction decoding at scale
IBM

IBM, AMD advance quantum error correction decoding at scale

Translations are now generally available
Medusajs

Translations are now generally available

2027 Ocean Market Outlook
Freightos

2027 Ocean Market Outlook

Turnitin Student Data & AI: Facts About How We Use Your Data
Turnitin

Turnitin Student Data & AI: Facts About How We Use Your Data

More from Neo4j

Using Neo4j Change Data Capture to Orchestrate Agents
Neo4j

Using Neo4j Change Data Capture to Orchestrate Agents

Announcing the Relate by Neo4j Hackathon 2026: Build AI Agents on an Embedded Graph Database
Neo4j

Announcing the Relate by Neo4j Hackathon 2026: Build AI Agents on an Embedded Graph Database

Meet Relate by Neo4j: An Embedded Database for AI Agents
Neo4j

Meet Relate by Neo4j: An Embedded Database for AI Agents

Agentic GraphRAG and an explorer for your own stack
Neo4j

Agentic GraphRAG and an explorer for your own stack

The Neo4j Ontology Graph Specification: A pragmatic, open, AI-first approach
Neo4j

The Neo4j Ontology Graph Specification: A pragmatic, open, AI-first approach

Neo4j Connector for Apache Kafka and Confluent v6
Neo4j

Neo4j Connector for Apache Kafka and Confluent v6