Graph algorithms in SAP HANA: on SFLIGHT and at TechEd
In the previous blog SAP HANA Graph visualizes SFLIGHT data we loaded SFLIGHT data into SAP HANA instance and created the graph workspace
"SFLIGHT"."CONNECTIONS_C". Then using built-in Graph Visualizer in Database Explorer we could visualize the graph.
One more thing that the Graph Visualizer allows you to do is to understand and explore your graph by running most common graph algorithms: Neighborhood, Strongly Connected, Shortest Path. One more option is a pattern search using OpenCypher language, but we will leave it for the next blog.
So, let’s check these three algorithms. They are all available under
“A directed graph is said to be strongly connected if every vertex is reachable from every other vertex.” (source: help)
There is a subgraph where 14 airports are strongly connected, meaning we can leave from any airport in this set and arrive to any other airport from the same set.
THF is connected with FRA, but only with the inbound connection. And MUC is not connected to any other airport. Obviously, it is the same in reality, but now we are exploring the dataset loaded from SFLIGHT.
“…the neighboring vertices within the given radius (depth) from the given start vertices.” (source: help)
Let’s check what are direct flights from Singapore accordingly to this dataset.
The Shortest Path
“…the shortest path from the provided start vertex to the provided target vertex – also known as single-source single-target shortest path” (source: help)
Let’s check the shortest path from Tokyo to New York JFK using flight time as a weight attribute.
Attending SAP TechEd this year…
…and would like to learn more?
For SAP TechEd I prepared hands-on exercises to explore these and other aspects of SAP HANA graph processing based on some real life data. You can join CodeJam, mini-edition in the Developer Garage on the show floor.
You can join as well another CodeJam on the show floor that I prepared on processing of geospatial data in SAP HANA using SQL.
- Las Vegas: https://sessioncatalog.sapevents.com/go/agendabuilder.speakers/?l=191&speaker_id=46888
- Barcelona: https://sessioncatalog.sapevents.com/go/agendabuilder.speakers/?l=192&speaker_id=46888
- Bangalore: https://sessioncatalog.sapevents.com/go/agendabuilder.speakers/?l=193&speaker_id=46888 (to be scheduled soon)
See you there, and – remember – do not use SFLIGHT sample data to schedule your flights!! 😉
-Vitaliy, aka @Sygyzmundovych