Getting Started with TigerGraph Starter Kits
By: Akash Kaul
Tags: Graph Database, Graph, Tigergraph

Getting Started with TigerGraph Starter Kits

Motivation

Fraud is a growing problem faced by all industries leading to billions of dollars lost every year. As hackers become more prevalent and more advanced, fraud detection is an issue that must be addressed immediately.

Enter, TigerGraph.

By harnessing the power of the graph, users can detect fraud in real-time, perform in-database machine learning, and identify hidden trends with deep link analytics.

Note: While this blog focuses on a fraud detection Starter Kit, the steps used to set up the graph are the same for any Starter Kit.

Using the Fraud Detection Starter Kit

Creating a Graph Instance

If you haven’t already done so, check out the guide Getting Started with TigerGraph 3.0. It contains all of the information needed to create a full graph, from creating an account to designing a schema to loading data.

Under the Create a Solution header, you can find instructions for creating an instance of a TigerGraph box. Follow those steps, this time choosing the Fraud and Money Laundering Detection (Fin. Services) Starter Kit.

Fraud Detection Starter Kit

Once the solution is done loading, open the solution in GraphStudio.

All Starter Kits come with the Design and Data Mapping complete. This saves us from a lot of headaches. To start using the kit, all we have to do is load the data.

Loading Data

First, make sure you see AntiFraud as the graph listed in the top left corner. Next, click the Load Data tab. Then, hit the play button to start the data loading.

Load Data Tab

After about one minute, all of the data should be loaded.

With that, the graph is now ready to use. It’s that easy!

Exploring the Graph

Instead of walking through the Explore Graph page, we’ll leave that up to you. There are lots of really interesting data available in this Starter Kit, so take the time to play around with selecting different vertex types, expanding from vertices, and finding paths between vertices. This will give you a really good sense of the data and the schema design for the graph.

Explore Graph Example

If you’re having trouble with some of the options available on this page, refer back to Getting Started with TigerGraph 3.0. The Explore page, along with every other page, is covered in great detail in that blog.

Running Queries

All Starter Kits come with a bunch of ready-to-use queries. All queries come with a few lines of text describing what the query does and how to use it.

Example Query

This Starter Kit comes with some very cool queries, including detecting users who abuse referral bonuses, finding circular flows of money (associated with money laundering), and determining whether a user is sending money to themselves via a fake account. These are all based on real-world scenarios, and I highly recommend looking at all of the queries to get a grasp of how they work conceptually and in terms of GSQL syntax.

But, let’s just try running two specific queries for now.

MultiTransaction

The comments for the MultiTransaction query are as follows:

This query is motivated by detecting money laundering activities between two groups. Given a transaction, it finds the network of users related to the sender, and finds the network of users related to the receiver. Then, it finds all transactions among the two networks. Intuitively this query can help data analysts to visualize the money laundering activities, since it can visualize the transactions between the sender and receiver groups, and the transaction patterns within each network. 1) Start from an input transaction, find its sender and reciever

2) Start from the sender, via Device_Token and Payment_Instrument edges find users within 4 steps.

3) Start from the reciever, via Device_Token and Payment_Instrument edges find users within 4 steps.

4) Record transactions cross the sender and receiver groups. Sample input

transaction: any integer between 1 and 500.

This tells us what the query does and provides a sample input for running it.

I randomly chose the number 333 as the input parameter.

Sample Query Input

Here’s what the visual output looked like:

Query Output (visual)

And here’s what the JSON output looked like:

Query Output (JSON)

According to the comments provided, the Start is supposed to print transactions in common between the networks of the sender and receiver of the input transaction. For this example, Start is empty, indicating that there are no common transactions, which suggests that this transaction and the users are trustworthy.

circleDetection

According to the provided comments, circleDetection is a query to detect money flow circles from a starting user.

Circle Detection Query

This query makes use of some features that only work for Installed queries. While Interpreted queries can run right away, they don’t offer all of the functionalities available.

You can find a full list of features not supported in Interpreted Mode here.

So, after installing the query and waiting for about 1 minute, we can finally run it.

Let’s try inputting a random user 456.

Circle Detection Query Input

Here’s the visual output.

Circle Detection Output (Visual)

You can clearly see that there is a circular trail of transactions and users around the input user.

Let’s see what the JSON output looks like.

Circle Detection Output (JSON)

In this case, the JSON output lists the connecting users and transactions that form the circle.

These queries are just a few examples of how fraud detection can be analyzed using graph databases. They also highlight some general methods of detecting fraud.

These queries come with the Starter Kit, but you of course can write any custom query you would like with the data provided.

Let's try writing a custom query.

CREATE QUERY TotalTransaction(Vertex<User> Source) FOR GRAPH AntiFraud { /*

This query grabs all transactions involving the input user

Example input: 333

*/ start = {Source}; transfer = SELECT tgt

FROM start:s -(User_Transfer_Transaction:e) - :tgt; receive = select tgt

FROM start:s -(User_Recieve_Transaction:e) -:tgt; PRINT transfer, receive; }

If you’re unfamiliar with GSQL, the proprietary query language for TigerGraph, check out this great article that goes through some of the basics.

The query above, given the id of a user in the graph, returns all transactions made by that user was a part of. This includes money transfers made by the user as well as transfers to the user.

Let’s try out the suggested input of 333.

Running example query

This query returns a sample of transactions, so the only output should be Transaction vertices. We can confirm this with the visual output of the graph.

Query output (visual)

We can also show this in the JSON output.

Query output (JSON)

This query was pretty basic, and there are many more powerful queries that can be implemented using this Starter Kit. But, we’ll leave that as a test of your creativity and GSQL skills.

Conclusion

In this blog, we covered a very brief overview of the Fraud and Money Laundering Detection Starter Kit from TigerGraph. This kit is just one of many kits covering everything from finance to healthcare to recommendation engines. I encourage you to explore other Starter Kits, following similar steps as those outlined in this blog. There’s a whole world of use cases for graph technologies, and we’ve only scratched the surface.

In the next chapter, we are going to further expand on this Starter Kit by developing a custom dashboard to visualize some of the data stored in this graph.