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 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’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 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.2            Writing Our First Traversal

8.2.2                     Developing the traversal code

8.3            Pagination and graph databases[2]

8.4            Recommending the Highest Rated Restaurants

8.6         Summary