パス探索

パス探索では、前の場所を再確認する必要がある場合に使用する場所に探索ステップがマッピングされます。

パス探索では、前の場所を再確認する必要がある場合に使用する場所に探索ステップがマッピングされます。

このパス探索は、1つの材料で開始され、レシピまで探索し、最終的には、指定した材料を含むレシピのある本を見つけます。
g.V().has('ingredient', 'name',within('beef','carrots')).in('includes').as('Recipe').
	out().hasLabel('book').as('Book').
	select('Book','Recipe').
		by('name').by('name').path()
この探索の出力には、各結果がリストされます。
==>[v[{~label=ingredient, member_id=2, community_id=1442590464}], 
	v[{~label=recipe, member_id=2, community_id=473764096}], 
	v[{~label=book, member_id=0, community_id=568859392}], 
	{Book=The Art of French Cooking, Vol. 1, Recipe=Beef Bourguignon}]
==>[v[{~label=ingredient, member_id=1, community_id=684566272}], 
	v[{~label=recipe, member_id=0, community_id=1462084224}], 
	v[{~label=book, member_id=1, community_id=1620680576}], 
	{Book=The Art of Simple Food:Notes, Lessons, and Recipes from a Delicious Revolution, Recipe=Carrot Soup}]
別のパス探索では、頂点ラベル(ここではbook)から発するツリーが作成されます。
g.V().hasLabel('book').in().tree().by('name').next()
この探索の出力には、各結果がリストされます。
==>Simca's Cuisine:100 Classic French Recipes for Every Occasion=
	{Patricia Simon={}, Simone Beck={}}
==>The Art of French Cooking, Vol. 1=
	{Simone Beck={}, Julia Child={}, Beef Bourguignon={}, Louisette Bertholie={}, Salade Nicoise={}}
==>The Art of Simple Food:Notes, Lessons, and Recipes from a Delicious Revolution=
	{Alice Waters={}, Kelsie Kerr={}, Roast Pork Loin={}, Carrot Soup={}, Fritz Streiff={}, Patricia Curtan={}}
==>The French Chef Cookbook=
	{Julia Child={}}
各本には著者、および本に含まれるレシピがリストされています。
別のツリー探索では、recipeからの外向きツリー・ブランチにあるすべての頂点を検出します。
g.V().hasLabel('recipe').out().tree().by('name').next()
この探索の出力には、各結果がリストされます。
==>Roast Pork Loin=
	{red wine={}, pork loin={}, chicken broth={}, The Art of Simple Food:Notes, Lessons, and Recipes from a Delicious Revolution={}}
==>Spicy Meatloaf=
	{bacon={}, celery={}, pork sausage={}, onion={}, ground beef={}, green bell pepper={}}
==>Beef Bourguignon=
	{mashed garlic={}, butter={}, The Art of French Cooking, Vol. 1={}, onion={}, tomato paste={}, beef={}}
==>Carrot Soup=
	{butter={}, onion={}, chicken broth={}, carrots={}, The Art of Simple Food:Notes, Lessons, and Recipes from a Delicious Revolution={}, thyme={}}
==>Rataouille=
	{mashed garlic={}, yellow onion={}, olive oil={}, zucchini={}, eggplant={}}
==>Salade Nicoise=
	{tuna={}, The Art of French Cooking, Vol. 1={}, hard-boiled egg={}, olive oil={}, tomato={}, green beans={}}
==>Wild Mushroom Stroganoff=
	{mushrooms={}, yellow onion={}, egg noodles={}}
==>Oysters Rockefeller=
	{oyster={}, chervil={}, parsley={}, celery={}, fennel={}, shallots={}, Pernod={}}
各レシピには、レシピの材料と、そのレシピを含む本がリストされます。