8 Building traversals using known walks

 

This chapter covers

  • Creating known-walk traversals
  • Translating business questions into graph traversals
  • Prioritizing strategies for traversal development
  • Paginating results in a graph traversal

Denise is one of the users of DiningByFriends. She recently traveled to Cincinnati, Ohio, for work and is looking for a recommendation for 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 answer this type of question. We also know that to answer this question, we 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 from this list is a pattern described as a known walk. Although we introduced the concept of known walks in chapter 7, this chapter dives into how we develop traversals for this pattern. To demonstrate this, we use the tangible target of our recommendation engine use case. We start by revisiting the requirements of the restaurant recommendation engine. We then identify the vertices and edges needed for our known-walk traversals. We follow that with developing the traversals for the use case. Finally, we 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.1.3 Setting up test data

8.2 Writing our first traversal

8.2.1 Designing our traversal

8.2.2 Developing the traversal code

8.3 Pagination and graph databases

8.4 Recommending the highest-rated restaurants

8.4.1 Designing our traversal

8.4.2 Developing the traversal code

8.5 Writing the last recommendation engine traversal

8.5.1 Designing our traversal

8.5.2 Adding this traversal to our application

Summary