Graph Algorithms Overview
Spanner Graph, in collaboration with Google Research Graph Mining , offers a suite of high-performance graph algorithms covering major use cases such as fraud detection, entity resolution and recommendation. The algorithms can scale up to tens of billions of edges with runtimes from minutes to tens of minutes. You run algorithms on Spanner Graph by calling an algorithm function in a Spanner Graph query.
Fully Managed
Spanner Graph algorithm is a fully managed service that uses Spanner Data Boost and independent on-demand compute resources well suited for large-scale graph analytical workloads. The architecture lets you run computationally intensive graph algorithms with near-zero impact on existing workloads on the provisioned Spanner instance.
Seamless GQL Integration
Graph algorithms are invoked as built-in function calls in Spanner Graph queries. You can export algorithm output to Cloud Storage or write it back to Spanner to augment the graph. You can use the Google Cloud console, Google Cloud CLI, client libraries, the REST API, or the RPC API to run a Spanner Graph query with an algorithm invocation the same way you run any other Spanner Graph query .
The following example shows how to run a connected component analysis in a
graph called FinGraph
to identify clusters of Accounts
connected by Transfers
and persist output to a Cloud Storage as my-bucket-name/my-output.csv
. For details, see Run
algorithms
.
EXPORT
DATA
OPTIONS
(
uri
=
"gs://my-bucket-name/my-output.csv"
,
format
=
"csv"
)
AS
GRAPH
FinGraph
CALL
WeaklyConnectedComponents
(
node_labels
=
>
[
'Account'
]
,
edge_labels
=
>
[
'Transfers'
]
)
YIELD
node
,
cluster
RETURN
node
.
id
,
cluster
;
Billing
Spanner Graph algorithms use Spanner Data Boost and independent compute resources for algorithm execution. You pay only for actual Serverless Processing Units (SPU) consumed when the algorithm compute is active. You can view graph algorithm billing information in the Google Cloud console
- Go to Billing Report
- In the Filterspanel, filter SKUsto the Spanner Data Boost SKU for each region where graph algorithms were used.
For more information about Spanner pricing, see Spanner pricing .
Permission
To invoke graph algorithms, a principal must have the spanner.databases.runGraphAlgorithms
Identity and Access Management (IAM) permission.
You can manage this permission by granting the roles/spanner.graphIntelligenceUser
IAM, or create a custom
role with the spanner.databases.runGraphAlgorithms
permission. Note that roles/spanner.graphIntelligenceUser
includes roles/spanner.databaseReaderWithDataBoost
.

