chapter eight

8 Building Traversals Using Known Walks

 

This chapter covers

  • Creating known walk traversals
  • Techniques for translating business questions into graph traversals
  • Prioritization strategies for traversal development
  • Pagination of results in a graph traversal

Denise is one of the users of DiningByFriend. She’s recently traveled to Cincinnati, Ohio for work and is looking for a recommendation on an excellent restaurant for dinner. From the work we did in the last chapter we know that our data model contains all the necessary information to and this type of question. We also know that to answer this question we’ll need to develop traversals that:

  • Traverse a specified set of vertices and edges
    • Traverse those elements in a set order
    • Traverse those elements a specific number of times

In the last chapter, we learned that traversing a graph with the attributes above is a graph traversal pattern described as a “known” walk. While we introduced the concept of known walks in chapter 7, this chapter will dive into the details about how we develop traversals for known walks.

To demonstrate this we’ll use the tangible target of our recommendation engine use case. We’ll start by revisiting the requirements of the recommendation engine. We’ll then identify the vertices and edges needed for our known walk traversals. We’ll follow that with developing the traversals for the use case. Finally, we’ll incorporate the traversals into our application.

8.1      Preparing to develop our traversals

8.1.1       Identifying the required elements

8.1.2       Selecting a starting place

8.2      Setting Up Test Data

8.3      Writing Our First Traversal

8.3.1       Constructing Our Traversal

8.4      Developing our Traversal

8.5      Extending our traversal with the id

8.6      Adding this traversal to our application

8.7      Pagination and graph databases[2]

8.8      Importance of ordering the inputs before calling range()

8.9      Recommending the Highest Rated Restaurants

8.9.1       Constructing Our Traversal

8.10  Developing our Traversal

8.11  Troubleshooting errors while developing a traversal

8.12  Mid-traversalFiltering

8.14  Adding this traversal to our application

8.16  Summary