SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Reference

hana-graph-examples

SQL scripts and a notebook demonstrating SAP HANA's built-in graph algorithms called from database procedures, from path finding over flight routes to isochrones on a London street network.

The self-contained scripts under GRAPH_PROCEDURE_EXAMPLES template built-in algorithms such as breadth-first search alongside custom ones like closeness centrality, all invoked from SQL. A flight-routes dataset drives a path-finding walkthrough, and a benchmark script compares sequential against parallel execution of a thousand shortest-path queries using the MAP_MERGE operator. Two applied scenarios go further: a Jupyter notebook reached through the hana-ml Python client analyses the Wellington stormwater network, and a London street-network script combines the graph engine's shortest-path algorithm with HANA spatial post-processing to calculate isochrones. It needs a current SAP HANA Cloud system, since some scripts do not run on older versions.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Graph, spatial and document dataBTPGraph, spatial and document datacapabilityStoring and querying data that is not plain rows, such as a network of relationships, a geometry or a JSON document, in the database that already holds the rows instead of in a separate store per model. Free-text search over entities is [search](capability:search); similarity over embeddings is [retrieval-augmented generation](capability:retrieval-augmented-generation).
Requires
SAP HANA CloudSAP HANA CloudartifactRunning the SQL scripts and notebooks against a real graph, spatial and document engine.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Brian BernardPersonContributes to this
In the atlas: contributes to 64
@btbernard
Markus FathPersonContributes to this
In the atlas: contributes to 1, wrote 3
@fath-markus
Jonathan WüstPersonContributes to this
In the atlas: contributes to 1
@yonarw
4 contributors

What it declares

Every artifact

Type
Sample
Origin
By SAP
Use as
A reference

As a sample

Form
Code snippets

Connections2

README

quoted from SAP-samples/hana-graph-examples under Apache-2.0, read
SAP-samples/hana-graph-examples/README.mdOn GitHub

REUSE status

SAP HANA Graph Examples

SAP HANA includes a graph engine for network analysis. The examples demonstrate the usage of built-in algorithms, e.g. for path finding.

Description

SAP HANA's built-in graph algorithms, e.g. for shortest path finding, can be invoked within database procedures. The procedures are called from SQL, which is a nice way to integrate graph processing with relational. The sample procedures included in this repository help you understand the power of the language and also provide code snippets and reuse templates.

Self-contained scripts are in the GRAPH_PROCEDURES_EXAMPLES folder. You'll find templates for the built-in algorithms, e.g. BFS, and templates for common algorithms like closeness centrality.

A more advanced script, specifically related to different variants of path finding, is based on a flight routes dataset OPENFLIGHTS.

Using the POKEC dataset, there is a script we used to benchmark sequential vs. parallel execution of 1000 shortest path queries. It serves as a template for using the MAP_MERGE operator to parallelize graph queries.

In July 2021 the SAP HANA Python Client API was enhanced and now includes functions to leverage HANA's multi-model capabilities including Spatial, Graph, and JSON Document Store. If you are a data scientist working in python take a look at the Jupyter Notebook that demonstrates the use of the graph extensions on the Wellington stormwater network network.

Using London street network data, there is a script that demonstrates how to calculate isochrones using the graph engine's built-in shortest path one-to-all algorithm and some HANA-native spatial post processing.

The Wellington stormwater scenario describes how to estimate risk using graph analysis. It uses HANA Spatial features to estimate the load on a waternetowkr in case of rain. Graph analysis is then used to understand how the water flows through the network.

Requirements

In order to run the examples yourself you need a SAP HANA Cloud system and a basic understand of SQL or python. To get a system yourself, just register for a trial and take a look at this tutorial. Once set up and connected, you just need to open the SQL Editor of the SAP HANA Database Explorer and run the statements in the script, or connect one of the Jupyter Notebooks. Some of the examples are self-contained, others are made for external datasets (e.g. https://openflights.org/data.html) which can be downloaded and imported into HANA tables.

Download and Installation

The .sql scripts can just be copied to a SQL Editor and executed.

Limitations

Some parts of the scripts may not run on older versions of SAP HANA Cloud - just make sure your system is up-to-date.

Known Issues

None.

How to obtain support

This project is provided "as-is" - there is no guarantee that raised issues will be answered or addressed in future releases.

Contributing

At this point, the repository is maintained by SAP only. External contributions will not be considered. However, you are welcome to open a bug report.

To-Do (upcoming changes)

We plan to include additional examples and a ready to deploy HANA database module later.

License

Copyright (c) 2020-2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/hana-graph-examplestree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, data-and-persistence
Contributors4

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-hana-graph-examples
JSON
/artifacts/sap-samples-hana-graph-examples.json
MCP
Connecting an agent