9 Working with subgraphs

 

This chapter covers

  • Defining subgraphs using traversals
  • Extracting subgraphs for future use
  • Working with previously extracted subgraphs
  • Using subgraphs to create modular, reusable code

Let’s say we have two users who both use DiningByFriends to find great restaurants in Houston, TX. Nancy lives north of Houston, and Sam lives to the south. Although each is friends with many people in the app, they have never connected to one another. We are making two reasonable assumptions here: Nancy and Sam have distinct friend groups because they live in different parts of town and have never met, and they want to visit local restaurants that their friends rate highly. What happens when they pose this question: “Based on how my friends rate restaurants, what are the best local restaurants for me?” They each expect to get recommendations for restaurants in their local area (North Houston for Nancy; South Houston for Sam) based on their friends’ ratings. How can we deliver results that are the most relevant to each of them?

9.1 Working with subgraphs

9.1.1 Extracting a subgraph

9.1.2 Traversing a subgraph

9.2 Building a subgraph for personalization

9.3 Building the traversal

9.3.1 Reversing the traversing direction

9.3.2 Evaluating the individualized results of the subgraph

9.4 Implementing a subgraph with a remote connection

9.4.1 Connecting with TinkerPop’s Client class

9.4.2 Adding this traversal to our application

Summary