Tag Archives: cypher

Faux Bitmap Indexes in Neo4j

If you’ve ever watched my talks about Neo4j, I tend to say we’re not very well optimized for Single Model queries where relationships aren’t considered. In fact, we’re kinda bad at it. Things got better when Composite Indexes were introduced, but we still have some limitations to deal with. Today we’re going to explore the issues and build our own faux “bitmap indexes” to get around this problem.
Continue reading

Tagged , , , , , , , , , , ,

Declarative Query Languages are the Iraq War of Computer Science

It’s Memorial Day weekend in the United States. Some people are staying home, others are observing the holiday quietly and others still are using it as an excuse to party because they have seemed to have forgotten that the entire world is once again at war. At war with a tiny enemy, so small some people think it’s a hoax. The worst part is the enemy is in each other, our friends and neighbors. But Memorial day is not about remembering the wars, but rather remembering the fallen. To remember those who gave all. Whatever you may think of war, all are terrible, some were necessary. I never served, so that’s about all I get to say about that.

About 14 years ago Ted Neward wrote a very long blog post on “The Vietnam of Computer Science”. There is a follow up, and a short summary by Jeff Atwood as well. If you have never read them, I ask you to do so now…and with that, I believe Query Languages are the Iraq War of Computer Science.

Continue reading

Tagged , , , , , , , , ,

Composite Indexes in Neo4j 4.0

Neo4j 4.0 has officially launched and folks are very excited about some of the new features including multiple graphs and schema based security. But you should also be excited about some of the more “quality of life” improvements in the product. One we will talk about today is the upgrade that composite indexes received.

Continue reading

Tagged , , , , , , , ,

Getting the latest transactions

On Neo4j’s User Slack someone was having a bit of a hard time getting a query to return quickly. Their model had User Nodes and Transaction Nodes, and they wanted to get the last 25 transactions for a user. This particular user had millions of transactions and the query was taking forever. I’m going to show you how we can speed up the query and hopefully teach you a new modeling trick you can use in your graphs.

Continue reading

Tagged , , , , ,

Finding Fraud Part Two

In the last blog post, we saw how we can use Neo4j to find the merchants where credit card fraud originated or was used for testing stolen data in order to prevent further fraudulent charges. It stemmed from a webinar on our amazing youtube channel with has hundreds of videos about graphs and Neo4j. We will continue diving in to the technical details by looking at how Neo4j can help you find Fraud Rings. The way this fraud works is that a large set of synthetic accounts are created and act like normal customers. Over time they request higher and higher levels of credit which they pay back on time. Then they all request the maximum credit they can get, take out the money, and disappear! Let’s find them before this happens.

Continue reading

Tagged , , , , , , , , ,

Finding Fraud

It’s no secret that one of our hottest use cases lately has been Fraud Detection. A while back we did a webinar talking about some of the ways you could use Neo4j to fight fraud. Watch it, if you haven’t yet. Today I want to augment that webinar with some cypher queries. Let’s see how it works:
Continue reading

Tagged , , , , , , , , , , , ,

Parallel K-Hop Counts

As a foreigner I was a little perplexed the first time I went to IHOP. You are served a stack of pancakes 3-5 high. How do you eat them? Do you pour syrup over the top and cut down through all the layers and eat them that way… or do you unstack them, pour syrup over each one and eat one at a time? If you are American, you eat them stacked. If you see someone eat them one at a time, you know they are shape-shifting lizard people. But doesn’t that mean the bottom layers are dry and don’t get any butter or syrup on them? Well you would think, but Americans are an ingenious people and they found a way to fix that problem. More syrup, more and more, and then a bit more to be sure… and a side of bacon. Now that you know all about IHOP, let’s switch gears to KHOP. Let’s say you wanted to find out how many nodes there were k-hops away from a starting node. What would be the best way to do that?

Continue reading

Tagged , , , , , , , , ,

Vendor Benchmarks

How does the saying go? There are lies, damned lies, and benchmarks. I’ve already made my feelings about database vendor benchmarks known, but in case you missed it. They are complete fabrications. Never to be trusted, never ever. Never. But vendors love to do benchmarks, they love spreading fear, uncertainty and doubt instead of spending their time doing productive things like creating useful content that teaches people how to use their product. I wish I could just ignore this nonsense and focus on what really matters, like helping our customers to successful production rollouts, but alas, here we are.

Continue reading

Tagged , , , , , , ,

Finding Motifs in Cypher for Fun and Profit

If you are friends with Jessie, and Jessie is friends with Amy, there is a good chance you’ll eventually become friends with Amy too. In terms of a graph, this would be like a graph with three nodes and two relationships eventually building a third relationship to form a clique. This simple concept is one of the basis for recommendation engines. There are fancy terms for it, like “triadic closure” but basically it just means we are making triangles. But what about Amy’s friend Delilah? Is there a good chance now that you are friends with Amy that you’ll become friends with her? What about Jessie and Delilah? Can we extend the pattern to four nodes or five nodes and go beyond our simple triangle? Continue reading

Tagged , , , , , , , , , , ,

Modeling Events in Neo4j

No. Not modeling events, I’m talking about modeling events. Things that happen at different times typically in some known sequence. If you are a long time follower of my blog you know I love promoting the date property of an event into the relationship type to make use of Neo4j’s individual Node-RelationshipType partitioning to speed up my queries, but I’m going to show you something different today.
Continue reading

Tagged , , , , , , , , , ,