{"id":20484935,"url":"https://github.com/sap-samples/hana-graph-examples","last_synced_at":"2025-04-13T14:53:14.460Z","repository":{"id":37931103,"uuid":"300641457","full_name":"SAP-samples/hana-graph-examples","owner":"SAP-samples","description":"SAP HANA includes a graph engine for network analysis. The examples demonstrate the usage of built-in algorithms, e.g. for path finding.","archived":false,"fork":false,"pushed_at":"2025-03-07T13:10:47.000Z","size":71523,"stargazers_count":19,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T05:51:10.753Z","etag":null,"topics":["graph","network","sample","sample-code","sap-hana","shortest-paths"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-02T14:31:09.000Z","updated_at":"2024-12-13T17:30:46.000Z","dependencies_parsed_at":"2024-11-15T16:41:53.951Z","dependency_job_id":null,"html_url":"https://github.com/SAP-samples/hana-graph-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fhana-graph-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fhana-graph-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fhana-graph-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fhana-graph-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP-samples","download_url":"https://codeload.github.com/SAP-samples/hana-graph-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732509,"owners_count":21152851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph","network","sample","sample-code","sap-hana","shortest-paths"],"created_at":"2024-11-15T16:26:38.584Z","updated_at":"2025-04-13T14:53:14.421Z","avatar_url":"https://github.com/SAP-samples.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/hana-graph-examples)](https://api.reuse.software/info/github.com/SAP-samples/hana-graph-examples)\r\n\r\n# SAP HANA Graph Examples\r\nSAP HANA includes a graph engine for network analysis. The examples demonstrate the usage of built-in algorithms, e.g. for path finding.\r\n\r\n## Description\r\nSAP 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.\r\n\r\nSelf-contained scripts are in the GRAPH_PROCEDURES_EXAMPLES folder. You'll find templates for the built-in algorithms, e.g. [BFS](GRAPH_PROCEDURE_EXAMPLES/BUILTIN_FUNCTIONS_ALGORITHMS/HANA_Cloud_2021Q1_Breadth_First_Search.sql), and templates for common algorithms like [closeness centrality](GRAPH_PROCEDURE_EXAMPLES/CUSTOM_ALGORITHMS/HANA_Cloud_2021Q1_Closeness_Centrality.sql).\r\n\r\nA more advanced script, specifically related to different variants of path finding, is based on a flight routes dataset [OPENFLIGHTS](OPENFLIGHTS/OPENFLIGHTS_shortest_paths.sql).\r\n\r\nUsing the [POKEC](https://snap.stanford.edu/data/soc-Pokec.html) dataset, there is a script we used to benchmark sequential vs. [parallel execution](POKEC/POKEC_1k_SP_pairs_bench_sequential_and_parallel.sql) of 1000 shortest path queries. It serves as a template for using the MAP_MERGE operator to parallelize graph queries.\r\n\r\nIn July 2021 the [SAP HANA Python Client API](https://pypi.org/project/hana-ml/) 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](NOTEBOOKS/WELLINGTON_STORMWATER/Wellington%20Stormwater%20Network%20Analysis.ipynb) that demonstrates the use of the graph extensions on the Wellington stormwater network network.\r\n\r\nUsing London street network data, there is a script that demonstrates [how to calculate isochrones](ISOCHRONES/README.md) using the graph engine's built-in shortest path one-to-all algorithm and some HANA-native spatial post processing.\r\n\r\nThe [Wellington stormwater](./WELLINGTON_STORMWATER/README.md) 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.\r\n\r\n## Requirements\r\nIn 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](https://www.sap.com/cmp/td/sap-hana-cloud-trial.html?source=hana-analytics-web) and take a look at this [tutorial](https://developers.sap.com/tutorials/hana-trial-advanced-analytics.html). 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.\r\nSome 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.\r\n\r\n## Download and Installation\r\nThe .sql scripts can just be copied to a SQL Editor and executed.\r\n\r\n## Limitations\r\nSome parts of the scripts may not run on older versions of SAP HANA Cloud - just make sure your system is up-to-date.\r\n\r\n## Known Issues\r\nNone.\r\n\r\n## How to obtain support\r\nThis project is provided \"as-is\" - there is no guarantee that raised issues will be answered or addressed in future releases.\r\n\r\n## Contributing\r\nAt this point, the repository is maintained by SAP only. External contributions will not be considered. However, you are welcome to open a bug report.\r\n\r\n## To-Do (upcoming changes)\r\nWe plan to include additional examples and a ready to deploy HANA database module later.\r\n\r\n## License\r\nCopyright (c) 2020 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](LICENSES/Apache-2.0.txt) file.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fhana-graph-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap-samples%2Fhana-graph-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fhana-graph-examples/lists"}