Category Archives: Cypher

Visualizing Activities

A few weeks ago I blogged about Activities in Neo4j, and we ended up with a way to recommend an activity to a user based on what sequence of activities they had done in the past. We also had a list of common sequences of activities, but they were a bit hard to digest. Today I’m going to show you how to visualize them so they make more sense.

Continue reading

Tagged , , , , , , , ,

Marketing Activities

The “footprints in the sand” poem is a story of a person walking on the beach with God and seeing two sets of footprints. The footprints represent the joys and sorrows of this persons life. During the worst of times the trail shows just one set of footprints. Confused as to why they would be abandoned at their time of need, God replies that “when you see only one set of footprints, it was then that I carried you”. It’s a touching poem, but a single set of footprints in the sand isn’t very graphy. Things get interesting when you superimpose the paths one over the other. We can then start to see where many paths converged and diverged, see how deep the footprints got at times, when they split where they went and where did they end up.
Continue reading

Tagged , , , , , , , , ,

The Real Property Graph

Is not that thing above. That’s a Chart, not a Graph. But anyway…Neo4j is designed to support the property graph model natively. There are a host of other technologies that can bolt-on a “graph layer” of some kind. However it doesn’t make them a graph database. It’s like adding a rear spoiler to a van, sure it may look cool… or ridiculous, but it won’t make it a race car. Don’t fall for it. If you need fast graph queries, use a real graph database. But today we won’t talk about that. Instead we’re going to talk about the real property graph…
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 , , , , , , , , ,

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 , , , , , , , , , ,

Filtering Connected Dynamic Forms

Sometimes I contrast Neo4j against relational databases by saying Neo4j is more like a dynamic typed language, and relational databases are more like a static typed language. In Neo4j you don’t have Tables or table definitions, any property can be of any valid value (Java primitives, arrays of Java primitives as well as time and spatial types). Two nodes with the same Label can have completely different properties, and any key can be of any type for different nodes. So for example a User labeled node may have the “id” property be “xyz”, while the “id” property for a Location labeled node may be a spatial type… but another User labeled node may also have the “id” property be a number or an array of floats, or whatever. This kind of freedom can drive people crazy, but it can also be leveraged to make very dynamic applications easy.
Continue reading

Tagged , , , , , , , ,

Calculating the best Rail Road paths in Neo4j

Did you know that Chicago is the most important railroad center in North America? Chicago has more lines of track radiating in more directions than from any other city. The windy city has long been the most important interchange point for freight traffic between the nation’s major railroads and it is the hub of Amtrak, the intercity rail passenger system. You may not realize it, but railroad tracks and graph theory have a history together. Back in the mid 1950s the US Military had an interest in finding out how much capacity the Soviet railway network had to move cargo from the Western Soviet Union to Eastern Europe. This lead to the Maximum Flow problem and the Ford–Fulkerson algorithm to solve it.

Continue reading

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