SlideShare a Scribd company logo
Graph Gurus
Episode 11
Using Accumulators in GSQL
for Complex Graph Analytics
© 2019 TigerGraph. All Rights Reserved
Welcome
● Attendees are muted
● If you have any Zoom issues please contact the panelists via chat
● We will have 10 min for Q&A at the end so please send your questions
at any time using the Q&A tab in the Zoom menu
● The webinar will be recorded and sent via email
2
© 2019 TigerGraph. All Rights Reserved
Developer Edition Available
We now offer Docker versions and VirtualBox versions of the TigerGraph
Developer Edition, so you can now run on
● MacOS
● Windows 10
● Linux
Developer Edition Download https://www.tigergraph.com/developer/
3
Version 2.3
Released Today
© 2019 TigerGraph. All Rights
Reserved
Today's Gurus
4
Victor Lee
Director of Product Management
● BS in Electrical Engineering and Computer Science
from UC Berkeley, MS in Electrical Engineering from
Stanford University
● PhD in Computer Science from Kent State University
focused on graph data mining
● 15+ years in tech industry
Gaurav Deshpande
Vice President of Marketing
● Built out and positioned IBM’s Big Data and Analytics
portfolio, driving 45 percent year-over-year growth.
● Led 2 startups through explosive growth - i2
Technologies (IPO) & Trigo Technologies (largest MDM
acquisition by IBM)
● Big Data Analytics Veteran, 14 patents in supply chain
management and big data analytics
© 2019 TigerGraph. All Rights Reserved
How Can TigerGraph Help You?
Improve Operational EfficiencyReduce Costs & Manage RisksIncrease Revenue
• Recommendation Engine
• Real-time Customer 360/
MDM
• Product & Service Marketing
• Fraud Detection
• Anti-Money Laundering
(AML)
• Risk Assessment & Monitoring
• Cyber Security
• Enterprise Knowledge Graph
• Network, IT and Cloud
Resource Optimization
• Energy Management System
• Supply Chain Analysis
Analyze all interactions
in real-time to sell more
Reduce costs and assess and
monitor risks effectively
Manage resources for
maximum output
Foundational Use Cases: Geospatial Analysis, Time Series Analysis, AI and Machine Learning
© 2019 TigerGraph. All Rights Reserved
Driving Business Outcomes with TigerGraph
Increase Revenue
Grew to Billion+ in annual
revenue in 5 years with
TigerGraph
Reduce Costs &
Manage Risks
Recommendation Engine
Detects fraud in real-time
for 300+ Million calls per
day with TigerGraph
Fraud Detection
Improve Operational
Efficiency
Improve Operational
Efficiency
Optimizes infrastructure to
minimize outages for
critical workloads with
TigerGraph
Network & IT Resource Optimization
© 2019 TigerGraph. All Rights Reserved
Accumulators
7
Example: A teacher collects test papers
from all students and calculates an
average score.
Teacher: node with an accumulator
Student: node
Student-to-teacher: edge
Test paper: message sent to
accumulator
Average Score: final value of
accumulator
Phase 1: teacher collects all the test
papers
Phase 2: teacher grades it and
calculates the average score.
© 2019 TigerGraph. All Rights Reserved
Example 1: Counting Movies Seen by
Friends
Analogy: You ask each of your friends to tally how many movies they
saw last year (They work at the same time → Parallelism!)
● This is the Gathering phase
● Next, you need to
Consolidate into one list.
→ Eliminate the duplicates Lee
Bob
Chris
Sue
If we are only counting (not recording names),
How can we eliminate duplicates?
P
Q
R
S
T
© 2019 TigerGraph. All Rights Reserved
Eliminating Duplication: visited flag
● Traditional method: Each target
Item has a true/false "flag", initialized to "false"
● If a flag is "false":
○ It may be counted;
Set the flag to "true"
● If a flag is "true":
○ Skip it
● ⇒ Each item is counted once
Lee
Bob
Chris
Sue
If we are only counting (not recording names),
How can we eliminate duplicates?
© 2019 TigerGraph. All Rights Reserved
Counting Movies with Accumulators
An accumulator is a runtime, shared variable with a built-in update
function.
1. Each friend's tally is a local Accumulator.
2. The visited flag is also a local Accumulator.
a. Bob, Chris, and Sue all visit "R", but we don't know who will first.
3. GSQL queries are designed to let each friend work in parallel, but
at its own pace, and in any order
4. Consolidate the Lists into one global Accumulator.
Bob: 2 (P, Q) Chris: 1 (S)
Sue: 2 (R,T)
© 2019 TigerGraph. All Rights Reserved
Optimization: One global list/tally
Instead of each friend keeping a separate tally…
Keep only one tally.
● Eliminates the consolidate step
● Saves memory
Each friend still works separately,
but they record their efforts in one common place.
Lee
Bob
Chris
Sue
© 2019 TigerGraph. All Rights Reserved
friendsMovieCount GSQL Query
CREATE QUERY friendsMovieCount (VERTEX me) {
OrAccum @visited = false; // @ means local
SumAccum<INT> @@movieCount; // @@ means global
#~~~~~~~~~~~~~~
Start = {me};
Friends = SELECT f # 1. Identify my friends
FROM Start:s -(friendOf:e)- Person:f;
#~~~~~~~~~~~~~~
Movies = SELECT m # 2. Identify the movies they've seen
FROM Friends:f -(saw:r)- Movie:m
ACCUM
IF m.@visited == false THEN
@@movieCount += 1, m.@visited += true; # 3. Count each movie once
#~~~~~~~~~~~~~~
PRINT @@movieCount;
}
© 2019 TigerGraph. All Rights Reserved
Review - Accumulator Properties
● Scope: Local (per vertex) or global
● Multiple data types and functions available
○ For flag: Boolean true/false data, OR function
○ For tally: Integer data, Sum function
● Supports multi-worker processing for parallelism
○ Shared: Anyone can read
○ Shared: Anyone can update submit an update request
○ All the accumulated updates are processed at once, at the end.
© 2019 TigerGraph. All Rights Reserved
Types of Accumulators
The GSQL language provides many different accumulators, which follow the
same rules for receiving and accessing data. However each of them has their
unique way of aggregating values.
14
Old Value:
2
New Value:
11
1, 3, 5
1
3 5
SumAccum<int>
Old Value:
2
New Value:
5
1, 3, 5
1 3
MaxAccum<int>
Old Value:
2
New Value:
1
1, 3, 5
1 3
MinAccum<int>
Old Value:
2
New Value:
2.75
1, 3, 5
1 3
AvgAccum
5 5 5
Computes and stores the
cumulative sum of numeric
values or the cumulative
concatenation of text values.
Computes and stores the
cumulative maximum of
a series of values.
Computes and stores the
cumulative mean of a
series of numeric values.
Computes and stores the
cumulative minimum of
a series of values.
© 2019 TigerGraph. All Rights Reserved
The GSQL language provides many different accumulators, which follow the
same rules for receiving and accessing data. However each of them has their
unique way of aggregating values.
15
Old Value:
[2]
New Value:
[2,1,3,5]
1, 3, 3, 5
1 3 5
SetAccum<int>
Old Value:
[2]
New Value:
[2,1,5,3,3]
1, 5, 3, 3
1 3
ListAccum<int>
Old Value:
[1->1]
New Value:
1->6
5->2
1->2
1->3
5->2
1->2 1->3
MapAccum<int,SumAccum<int>>
Old Value:
[userD,150]
New Value:
[userC,300,
UserD,150,
userA,100]
userC,300
userA,100
(“userA”, 100)
HeapAccum<Tuple>
5 5->23 3 (“userC”, 300)
Maintains a collection of
unique elements.
Maintains a sequential
collection of elements.
Maintains a collection of
(key → value) pairs.
Maintains a sorted collection of
tuples and enforces a
maximum number of tuples in
the collection
Types of Accumulators, continued
© 2019 TigerGraph. All Rights Reserved
Use Case: Graph Algorithms
PageRank analyzes the WHOLE graph
● For each node V:
PR(V) = sum [ PR(A)
/deg(A)
+ PR(B)
/deg(B)
+ PR(C)
/deg(C)
]
○ Summing contributions from several independent nodes
→ Ideal task for accumulators and parallel processing
● Compute a score for each node → parallelism
● Iterative method: Keep recalculating PR(v) for the full graph,
unless the max change in PR < threshold → MaxAccum
V
A
B
C
© 2018 TigerGraph. All Rights Reserved 17
Input:
A person p, two integer parameters k1
and k2
Algorithm steps:
1. Find all movies p has rated;
2. Find all persons rated same movies as p;
3. Based on the movie ratings, find the k1
persons that have most similar tastes with p;
4. Find all movies these k1
persons rated that p hasn’t rated yet;
5. Recommend the top k2
movies with highest average rating by the k1
persons;
Output:
At most k2
movies to be recommended to person p.
p
…...
rate
rate
rate
PRatedMovies
PSet
…...
PeopleRatedSameMovies
rate
rate
rate
rate
…...
rate
rate
rate
rate
Implementing Movie Recommendation Algorithm
© 2019 TigerGraph. All Rights Reserved
More Use Cases: Anti-Fraud
TestDrive Anti-Fraud: https://testdrive.tigergraph.com/main/dashboard
CIrcle Detection:
● Is money passing from A → B → C → … → back to A?
See Graph Gurus #4 on our YouTube Channel:
https://www.youtube.com/tigergraph
© 2019 TigerGraph. All Rights Reserved
Demo
19
© 2019 TigerGraph. All Rights Reserved
Summary
• Graph Traversal and Graph Analytics can be
complex, but also amenable to parallelism.
• Accumulators, coupled with the TigerGraph MPP
engine, provide simple and efficient parallelized
aggregation.
• Accumulators come in a variety of shapes and sizes,
to fit all different needs.
20
Q&A
Please send your questions via the Q&A menu in Zoom
21
© 2019 TigerGraph. All Rights Reserved
NEW! Graph Gurus Developer Office Hours
22
The Graph Gurus Webinar in late March or catch up on previous
episodes: https://www.tigergraph.com/webinars-and-events/
Every Thursday at 11:00 am Pacific
Talk directly with our engineers every
week. During office hours, you get
answers to any questions pertaining to
graph modeling and GSQL
programming.
https://info.tigergraph.com/officehours
© 2019 TigerGraph. All Rights Reserved
Additional Resources
23
New Developer Portal
https://www.tigergraph.com/developers/
Download the Developer Edition or Enterprise Free Trial
https://www.tigergraph.com/download/
Guru Scripts
https://github.com/tigergraph/ecosys/tree/master/guru_scripts
Join our Developer Forum
https://groups.google.com/a/opengsql.org/forum/#!forum/gsql-users
@TigerGraphDB youtube.com/tigergraph facebook.com/TigerGraphDB linkedin.com/company/TigerGraph

More Related Content

PPTX
The openCypher Project - An Open Graph Query Language
PDF
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
PPTX
Get Started with the Most Advanced Edition Yet of Neo4j Graph Data Science
PPTX
Azure Databricks is Easier Than You Think
PDF
Graph Gurus Episode 31: GSQL Writing Best Practices Part 1
PDF
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
PDF
Spark SQL Join Improvement at Facebook
PDF
From airflow to google cloud composer
The openCypher Project - An Open Graph Query Language
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
Get Started with the Most Advanced Edition Yet of Neo4j Graph Data Science
Azure Databricks is Easier Than You Think
Graph Gurus Episode 31: GSQL Writing Best Practices Part 1
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Spark SQL Join Improvement at Facebook
From airflow to google cloud composer

What's hot (20)

PDF
Graph Databases and Machine Learning | November 2018
PDF
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
PPTX
Power bi overview
PDF
KSnow: Getting started with Snowflake
PPTX
Real-Time Data Flows with Apache NiFi
PDF
Exploring BigData with Google BigQuery
PDF
Neo4j 4.1 overview
PDF
Airflow presentation
PDF
Standing on the Shoulders of Open-Source Giants: The Serverless Realtime Lake...
PPTX
Apache Tez - A New Chapter in Hadoop Data Processing
PPTX
Navigating the Workday Analytics and Reporting Ecosystem
PDF
Graph database Use Cases
PDF
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
PPTX
Knowledge Graph Introduction
PDF
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
PDF
A Deep Dive into Query Execution Engine of Spark SQL
PDF
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
PPT
Hadoop Security Architecture
PDF
Real-Time Forecasting at Scale using Delta Lake and Delta Caching
PDF
Modern Data Challenges require Modern Graph Technology
Graph Databases and Machine Learning | November 2018
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
Power bi overview
KSnow: Getting started with Snowflake
Real-Time Data Flows with Apache NiFi
Exploring BigData with Google BigQuery
Neo4j 4.1 overview
Airflow presentation
Standing on the Shoulders of Open-Source Giants: The Serverless Realtime Lake...
Apache Tez - A New Chapter in Hadoop Data Processing
Navigating the Workday Analytics and Reporting Ecosystem
Graph database Use Cases
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
Knowledge Graph Introduction
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
A Deep Dive into Query Execution Engine of Spark SQL
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Hadoop Security Architecture
Real-Time Forecasting at Scale using Delta Lake and Delta Caching
Modern Data Challenges require Modern Graph Technology
Ad

Similar to Graph Gurus Episode 11: Accumulators for Complex Graph Analytics (20)

PDF
Graph Gurus 15: Introducing TigerGraph 2.4
PDF
Graph Gurus Episode 7: Connecting the Dots in Real-Time: Deep Link Analysis w...
PDF
DA 592 - Term Project Report - Berker Kozan Can Koklu
PDF
Using Graph Algorithms for Advanced Analytics - Part 5 Classification
PDF
Graph Gurus Episode 32: Using Graph Algorithms for Advanced Analytics Part 5
PPTX
Learning to Rank: From Theory to Production - Malvina Josephidou & Diego Cecc...
PDF
Flink Forward San Francisco 2018: Gregory Fee - "Bootstrapping State In Apach...
PDF
Planning and Tracking Agile Projects
PPTX
Introduction to GluonNLP
PDF
Graph Gurus 21: Integrating Real-Time Deep-Link Graph Analytics with Spark AI
PDF
Graph Gurus Episode 19: Deep Learning Implemented by GSQL on a Native Paralle...
PDF
Graph Gurus Episode 3: Anti Fraud and AML Part 1
PDF
Python tutorial for ML
PDF
Graph Gurus Episode 26: Using Graph Algorithms for Advanced Analytics Part 1
PDF
Deep learning for product title summarization
PPTX
Bootstrapping state in Apache Flink
PDF
Machine learning for predictive maintenance external
PPTX
No liftoff, touchdown, or heartbeat shall miss because of a software failure
PPTX
Node.js Deeper Dive
PDF
Using Graph Algorithms For Advanced Analytics - Part 4 Similarity 30 graph al...
Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus Episode 7: Connecting the Dots in Real-Time: Deep Link Analysis w...
DA 592 - Term Project Report - Berker Kozan Can Koklu
Using Graph Algorithms for Advanced Analytics - Part 5 Classification
Graph Gurus Episode 32: Using Graph Algorithms for Advanced Analytics Part 5
Learning to Rank: From Theory to Production - Malvina Josephidou & Diego Cecc...
Flink Forward San Francisco 2018: Gregory Fee - "Bootstrapping State In Apach...
Planning and Tracking Agile Projects
Introduction to GluonNLP
Graph Gurus 21: Integrating Real-Time Deep-Link Graph Analytics with Spark AI
Graph Gurus Episode 19: Deep Learning Implemented by GSQL on a Native Paralle...
Graph Gurus Episode 3: Anti Fraud and AML Part 1
Python tutorial for ML
Graph Gurus Episode 26: Using Graph Algorithms for Advanced Analytics Part 1
Deep learning for product title summarization
Bootstrapping state in Apache Flink
Machine learning for predictive maintenance external
No liftoff, touchdown, or heartbeat shall miss because of a software failure
Node.js Deeper Dive
Using Graph Algorithms For Advanced Analytics - Part 4 Similarity 30 graph al...
Ad

More from TigerGraph (20)

PDF
MAXIMIZING THE VALUE OF SCIENTIFIC INFORMATION TO ACCELERATE INNOVATION
PDF
Better Together: How Graph database enables easy data integration with Spark ...
PDF
Building an accurate understanding of consumers based on real-world signals
PDF
Care Intervention Assistant - Omaha Clinical Data Information System
PDF
Correspondent Banking Networks
PDF
Delivering Large Scale Real-time Graph Analytics with Dell Infrastructure and...
PDF
Deploying an End-to-End TigerGraph Enterprise Architecture using Kafka, Maria...
PDF
Fraud Detection and Compliance with Graph Learning
PDF
Fraudulent credit card cash-out detection On Graphs
PDF
FROM DATAFRAMES TO GRAPH Data Science with pyTigerGraph
PDF
Customer Experience Management
PDF
Graph+AI for Fin. Services
PDF
Davraz - A graph visualization and exploration software.
PDF
Plume - A Code Property Graph Extraction and Analysis Library
PDF
TigerGraph.js
PDF
GRAPHS FOR THE FUTURE ENERGY SYSTEMS
PDF
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
PDF
How to Build An AI Based Customer Data Platform: Learn the design patterns fo...
PDF
Machine Learning Feature Design with TigerGraph 3.0 No-Code GUI
PDF
Recommendation Engine with In-Database Machine Learning
MAXIMIZING THE VALUE OF SCIENTIFIC INFORMATION TO ACCELERATE INNOVATION
Better Together: How Graph database enables easy data integration with Spark ...
Building an accurate understanding of consumers based on real-world signals
Care Intervention Assistant - Omaha Clinical Data Information System
Correspondent Banking Networks
Delivering Large Scale Real-time Graph Analytics with Dell Infrastructure and...
Deploying an End-to-End TigerGraph Enterprise Architecture using Kafka, Maria...
Fraud Detection and Compliance with Graph Learning
Fraudulent credit card cash-out detection On Graphs
FROM DATAFRAMES TO GRAPH Data Science with pyTigerGraph
Customer Experience Management
Graph+AI for Fin. Services
Davraz - A graph visualization and exploration software.
Plume - A Code Property Graph Extraction and Analysis Library
TigerGraph.js
GRAPHS FOR THE FUTURE ENERGY SYSTEMS
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
How to Build An AI Based Customer Data Platform: Learn the design patterns fo...
Machine Learning Feature Design with TigerGraph 3.0 No-Code GUI
Recommendation Engine with In-Database Machine Learning

Recently uploaded (20)

PDF
AI in Product Development-omnex systems
PDF
System and Network Administraation Chapter 3
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Introduction to Artificial Intelligence
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Understanding Forklifts - TECH EHS Solution
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
AI in Product Development-omnex systems
System and Network Administraation Chapter 3
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Navsoft: AI-Powered Business Solutions & Custom Software Development
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Softaken Excel to vCard Converter Software.pdf
Introduction to Artificial Intelligence
VVF-Customer-Presentation2025-Ver1.9.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Operating system designcfffgfgggggggvggggggggg
Understanding Forklifts - TECH EHS Solution
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
Design an Analysis of Algorithms I-SECS-1021-03
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

Graph Gurus Episode 11: Accumulators for Complex Graph Analytics

  • 1. Graph Gurus Episode 11 Using Accumulators in GSQL for Complex Graph Analytics
  • 2. © 2019 TigerGraph. All Rights Reserved Welcome ● Attendees are muted ● If you have any Zoom issues please contact the panelists via chat ● We will have 10 min for Q&A at the end so please send your questions at any time using the Q&A tab in the Zoom menu ● The webinar will be recorded and sent via email 2
  • 3. © 2019 TigerGraph. All Rights Reserved Developer Edition Available We now offer Docker versions and VirtualBox versions of the TigerGraph Developer Edition, so you can now run on ● MacOS ● Windows 10 ● Linux Developer Edition Download https://www.tigergraph.com/developer/ 3 Version 2.3 Released Today
  • 4. © 2019 TigerGraph. All Rights Reserved Today's Gurus 4 Victor Lee Director of Product Management ● BS in Electrical Engineering and Computer Science from UC Berkeley, MS in Electrical Engineering from Stanford University ● PhD in Computer Science from Kent State University focused on graph data mining ● 15+ years in tech industry Gaurav Deshpande Vice President of Marketing ● Built out and positioned IBM’s Big Data and Analytics portfolio, driving 45 percent year-over-year growth. ● Led 2 startups through explosive growth - i2 Technologies (IPO) & Trigo Technologies (largest MDM acquisition by IBM) ● Big Data Analytics Veteran, 14 patents in supply chain management and big data analytics
  • 5. © 2019 TigerGraph. All Rights Reserved How Can TigerGraph Help You? Improve Operational EfficiencyReduce Costs & Manage RisksIncrease Revenue • Recommendation Engine • Real-time Customer 360/ MDM • Product & Service Marketing • Fraud Detection • Anti-Money Laundering (AML) • Risk Assessment & Monitoring • Cyber Security • Enterprise Knowledge Graph • Network, IT and Cloud Resource Optimization • Energy Management System • Supply Chain Analysis Analyze all interactions in real-time to sell more Reduce costs and assess and monitor risks effectively Manage resources for maximum output Foundational Use Cases: Geospatial Analysis, Time Series Analysis, AI and Machine Learning
  • 6. © 2019 TigerGraph. All Rights Reserved Driving Business Outcomes with TigerGraph Increase Revenue Grew to Billion+ in annual revenue in 5 years with TigerGraph Reduce Costs & Manage Risks Recommendation Engine Detects fraud in real-time for 300+ Million calls per day with TigerGraph Fraud Detection Improve Operational Efficiency Improve Operational Efficiency Optimizes infrastructure to minimize outages for critical workloads with TigerGraph Network & IT Resource Optimization
  • 7. © 2019 TigerGraph. All Rights Reserved Accumulators 7 Example: A teacher collects test papers from all students and calculates an average score. Teacher: node with an accumulator Student: node Student-to-teacher: edge Test paper: message sent to accumulator Average Score: final value of accumulator Phase 1: teacher collects all the test papers Phase 2: teacher grades it and calculates the average score.
  • 8. © 2019 TigerGraph. All Rights Reserved Example 1: Counting Movies Seen by Friends Analogy: You ask each of your friends to tally how many movies they saw last year (They work at the same time → Parallelism!) ● This is the Gathering phase ● Next, you need to Consolidate into one list. → Eliminate the duplicates Lee Bob Chris Sue If we are only counting (not recording names), How can we eliminate duplicates? P Q R S T
  • 9. © 2019 TigerGraph. All Rights Reserved Eliminating Duplication: visited flag ● Traditional method: Each target Item has a true/false "flag", initialized to "false" ● If a flag is "false": ○ It may be counted; Set the flag to "true" ● If a flag is "true": ○ Skip it ● ⇒ Each item is counted once Lee Bob Chris Sue If we are only counting (not recording names), How can we eliminate duplicates?
  • 10. © 2019 TigerGraph. All Rights Reserved Counting Movies with Accumulators An accumulator is a runtime, shared variable with a built-in update function. 1. Each friend's tally is a local Accumulator. 2. The visited flag is also a local Accumulator. a. Bob, Chris, and Sue all visit "R", but we don't know who will first. 3. GSQL queries are designed to let each friend work in parallel, but at its own pace, and in any order 4. Consolidate the Lists into one global Accumulator. Bob: 2 (P, Q) Chris: 1 (S) Sue: 2 (R,T)
  • 11. © 2019 TigerGraph. All Rights Reserved Optimization: One global list/tally Instead of each friend keeping a separate tally… Keep only one tally. ● Eliminates the consolidate step ● Saves memory Each friend still works separately, but they record their efforts in one common place. Lee Bob Chris Sue
  • 12. © 2019 TigerGraph. All Rights Reserved friendsMovieCount GSQL Query CREATE QUERY friendsMovieCount (VERTEX me) { OrAccum @visited = false; // @ means local SumAccum<INT> @@movieCount; // @@ means global #~~~~~~~~~~~~~~ Start = {me}; Friends = SELECT f # 1. Identify my friends FROM Start:s -(friendOf:e)- Person:f; #~~~~~~~~~~~~~~ Movies = SELECT m # 2. Identify the movies they've seen FROM Friends:f -(saw:r)- Movie:m ACCUM IF m.@visited == false THEN @@movieCount += 1, m.@visited += true; # 3. Count each movie once #~~~~~~~~~~~~~~ PRINT @@movieCount; }
  • 13. © 2019 TigerGraph. All Rights Reserved Review - Accumulator Properties ● Scope: Local (per vertex) or global ● Multiple data types and functions available ○ For flag: Boolean true/false data, OR function ○ For tally: Integer data, Sum function ● Supports multi-worker processing for parallelism ○ Shared: Anyone can read ○ Shared: Anyone can update submit an update request ○ All the accumulated updates are processed at once, at the end.
  • 14. © 2019 TigerGraph. All Rights Reserved Types of Accumulators The GSQL language provides many different accumulators, which follow the same rules for receiving and accessing data. However each of them has their unique way of aggregating values. 14 Old Value: 2 New Value: 11 1, 3, 5 1 3 5 SumAccum<int> Old Value: 2 New Value: 5 1, 3, 5 1 3 MaxAccum<int> Old Value: 2 New Value: 1 1, 3, 5 1 3 MinAccum<int> Old Value: 2 New Value: 2.75 1, 3, 5 1 3 AvgAccum 5 5 5 Computes and stores the cumulative sum of numeric values or the cumulative concatenation of text values. Computes and stores the cumulative maximum of a series of values. Computes and stores the cumulative mean of a series of numeric values. Computes and stores the cumulative minimum of a series of values.
  • 15. © 2019 TigerGraph. All Rights Reserved The GSQL language provides many different accumulators, which follow the same rules for receiving and accessing data. However each of them has their unique way of aggregating values. 15 Old Value: [2] New Value: [2,1,3,5] 1, 3, 3, 5 1 3 5 SetAccum<int> Old Value: [2] New Value: [2,1,5,3,3] 1, 5, 3, 3 1 3 ListAccum<int> Old Value: [1->1] New Value: 1->6 5->2 1->2 1->3 5->2 1->2 1->3 MapAccum<int,SumAccum<int>> Old Value: [userD,150] New Value: [userC,300, UserD,150, userA,100] userC,300 userA,100 (“userA”, 100) HeapAccum<Tuple> 5 5->23 3 (“userC”, 300) Maintains a collection of unique elements. Maintains a sequential collection of elements. Maintains a collection of (key → value) pairs. Maintains a sorted collection of tuples and enforces a maximum number of tuples in the collection Types of Accumulators, continued
  • 16. © 2019 TigerGraph. All Rights Reserved Use Case: Graph Algorithms PageRank analyzes the WHOLE graph ● For each node V: PR(V) = sum [ PR(A) /deg(A) + PR(B) /deg(B) + PR(C) /deg(C) ] ○ Summing contributions from several independent nodes → Ideal task for accumulators and parallel processing ● Compute a score for each node → parallelism ● Iterative method: Keep recalculating PR(v) for the full graph, unless the max change in PR < threshold → MaxAccum V A B C
  • 17. © 2018 TigerGraph. All Rights Reserved 17 Input: A person p, two integer parameters k1 and k2 Algorithm steps: 1. Find all movies p has rated; 2. Find all persons rated same movies as p; 3. Based on the movie ratings, find the k1 persons that have most similar tastes with p; 4. Find all movies these k1 persons rated that p hasn’t rated yet; 5. Recommend the top k2 movies with highest average rating by the k1 persons; Output: At most k2 movies to be recommended to person p. p …... rate rate rate PRatedMovies PSet …... PeopleRatedSameMovies rate rate rate rate …... rate rate rate rate Implementing Movie Recommendation Algorithm
  • 18. © 2019 TigerGraph. All Rights Reserved More Use Cases: Anti-Fraud TestDrive Anti-Fraud: https://testdrive.tigergraph.com/main/dashboard CIrcle Detection: ● Is money passing from A → B → C → … → back to A? See Graph Gurus #4 on our YouTube Channel: https://www.youtube.com/tigergraph
  • 19. © 2019 TigerGraph. All Rights Reserved Demo 19
  • 20. © 2019 TigerGraph. All Rights Reserved Summary • Graph Traversal and Graph Analytics can be complex, but also amenable to parallelism. • Accumulators, coupled with the TigerGraph MPP engine, provide simple and efficient parallelized aggregation. • Accumulators come in a variety of shapes and sizes, to fit all different needs. 20
  • 21. Q&A Please send your questions via the Q&A menu in Zoom 21
  • 22. © 2019 TigerGraph. All Rights Reserved NEW! Graph Gurus Developer Office Hours 22 The Graph Gurus Webinar in late March or catch up on previous episodes: https://www.tigergraph.com/webinars-and-events/ Every Thursday at 11:00 am Pacific Talk directly with our engineers every week. During office hours, you get answers to any questions pertaining to graph modeling and GSQL programming. https://info.tigergraph.com/officehours
  • 23. © 2019 TigerGraph. All Rights Reserved Additional Resources 23 New Developer Portal https://www.tigergraph.com/developers/ Download the Developer Edition or Enterprise Free Trial https://www.tigergraph.com/download/ Guru Scripts https://github.com/tigergraph/ecosys/tree/master/guru_scripts Join our Developer Forum https://groups.google.com/a/opengsql.org/forum/#!forum/gsql-users @TigerGraphDB youtube.com/tigergraph facebook.com/TigerGraphDB linkedin.com/company/TigerGraph