{"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/46699615","id":46699615,"diff_hunk":"@@ -0,0 +1,93 @@\n+/*\n+ * Copyright (c) 2002-2015 \"Neo Technology,\"\n+ * Network Engine for Objects in Lund AB [http://neotechnology.com]\n+ *\n+ * This file is part of Neo4j.\n+ *\n+ * Neo4j is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+package org.neo4j.cypher.docgen\n+\n+import org.neo4j.cypher.docgen.tooling._\n+import org.neo4j.graphdb.Path\n+\n+class ShortestPathPlanningTest extends DocumentingTest {\n+  override def outputPath = \"target/docs/dev/execution-plan-groups/\"\n+  override def doc = new DocBuilder {\n+    doc(\"Shortest path planning\", \"query-shortestpath-planning\")\n+    initQueries(\n+      \"\"\"CREATE (charlie:Person {name:'Charlie Sheen'}),\n+        |       (martin:Person {name: 'Martin Sheen'}),\n+        |       (michael:Person {name: 'Michael Douglas'}),\n+        |       (oliver:Person {name: 'Oliver Stone'}),\n+        |       (rob:Person {name: 'Rob Reiner'}),\n+        |\n+        |       (wallStreet:Movie {title: 'Wall Street'}),\n+        |       (charlie)-[:ACTED_IN {role: \"Bud Fox\"}]->(wallStreet),\n+        |       (martin)-[:ACTED_IN {role: \"Carl Fox\"}]->(wallStreet),\n+        |       (michael)-[:ACTED_IN {role: \"Gordon Gekko\"}]->(wallStreet),\n+        |       (oliver)-[:DIRECTED]->(wallStreet),\n+        |\n+        |       (thePresident:Movie {title: 'The American President'}),\n+        |       (martin)-[:ACTED_IN {role: \"A.J. MacInerney\"}]->(thePresident),\n+        |       (michael)-[:ACTED_IN {role: \"President Andrew Shepherd\"}]->(thePresident),\n+        |       (rob)-[:DIRECTED]->(thePresident)\"\"\",\n+        \"CREATE INDEX ON :Person(name)\"\n+    )\n+    synopsis(\"Shortest path finding in Cypher and how it is planned\")\n+    section(\"-=-=-=-=-=-=-=-\") {\n+      p( \"\"\"Planning shortest paths in Cypher can lead to different query plans depending on the predicates that need\n+        |to be evaluated. Internally, Neo4j will use a fast bidirectional breadth-first search algorithm if the\n+        |predicates can be evaluated whilst searching for the path. If the predicates need to inspect the whole path\n+        |before deciding on whether it is valid or not, this fast algorithm cannot be used, and Neo4j will fall back to\n+        |a slower exhaustive search for the path. The difference between these two can be in the order of magnitude,\n+        |so it is important to ensure that the fast approach is used for time critical queries.\"\"\")\n+      p( \"\"\"When the exhaustive search is planned, it is still only executed when the fast algorithm fails to find any\n+           |matching paths. The fast algorithm is always executed first, since it is possible that it can find a valid\n+           |path even though that could not be guaranteed at planning time.\"\"\")\n+      query(\n+        \"\"\"MATCH (martin:Person {name:\"Martin Sheen\"} ),\n+          |      (charlie:Person {name:\"Charlie Sheen\"}),\n+          |      p = shortestPath( (martin)-[rels*]-(charlie) )\n+          |WHERE ALL(r in rels WHERE type(r) = \"ACTED_IN\")\n+          |RETURN p\"\"\", assertShortestPathLength) {\n+        p(\n+          \"\"\"This query can be evaluated with the fast algorithm - there are no predicates that need to see the whole path before being evaluated.\"\"\")\n+        profileExecutionPlan()\n+      }\n+      section(\"Single shortest path with predicates\") {\n+        p( \"\"\"Predicates used in the WHERE clause that apply to the shortest path pattern are evaluated before deciding what the shortest matching path is. \"\"\")\n+        query(\n+          \"\"\"MATCH (charlie:Person {name:\"Charlie Sheen\"}),\n+            |      (martin:Person {name:\"Martin Sheen\"}),\n+            |      p = shortestPath( (charlie)-[*]-(martin) )\n+            |WHERE length(p) > 1\n+            |RETURN p\"\"\", assertShortestPathLength) {\n+          p(","path":"manual/cypher/cypher-docs/src/test/scala/org/neo4j/cypher/docgen/ShortestPathPlanningTest.scala","position":77,"original_position":77,"commit_id":"47e108456d99a3f6080235b26c6011a814e635b8","original_commit_id":"47e108456d99a3f6080235b26c6011a814e635b8","user":{"login":"Mats-SX","id":2419675,"avatar_url":"https://avatars.githubusercontent.com/u/2419675?v=3","gravatar_id":"","url":"https://api.github.com/users/Mats-SX","html_url":"https://github.com/Mats-SX","followers_url":"https://api.github.com/users/Mats-SX/followers","following_url":"https://api.github.com/users/Mats-SX/following{/other_user}","gists_url":"https://api.github.com/users/Mats-SX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mats-SX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mats-SX/subscriptions","organizations_url":"https://api.github.com/users/Mats-SX/orgs","repos_url":"https://api.github.com/users/Mats-SX/repos","events_url":"https://api.github.com/users/Mats-SX/events{/privacy}","received_events_url":"https://api.github.com/users/Mats-SX/received_events","type":"User","site_admin":false},"body":"There's a bunch of these unnecessary newlines and spaces and triple-quoted strings. They stick in my eyes, but aren't critical obviously.","created_at":"2015-12-04T16:22:18Z","updated_at":"2015-12-04T16:22:18Z","html_url":"https://github.com/neo4j/neo4j/pull/6014#discussion_r46699615","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6014","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/46699615"},"html":{"href":"https://github.com/neo4j/neo4j/pull/6014#discussion_r46699615"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6014"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/6014","id":52474676,"html_url":"https://github.com/neo4j/neo4j/pull/6014","diff_url":"https://github.com/neo4j/neo4j/pull/6014.diff","patch_url":"https://github.com/neo4j/neo4j/pull/6014.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/6014","number":6014,"state":"open","locked":false,"title":"Document shortest path with predicates","user":{"login":"henriknyman","id":13960026,"avatar_url":"https://avatars.githubusercontent.com/u/13960026?v=3","gravatar_id":"","url":"https://api.github.com/users/henriknyman","html_url":"https://github.com/henriknyman","followers_url":"https://api.github.com/users/henriknyman/followers","following_url":"https://api.github.com/users/henriknyman/following{/other_user}","gists_url":"https://api.github.com/users/henriknyman/gists{/gist_id}","starred_url":"https://api.github.com/users/henriknyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henriknyman/subscriptions","organizations_url":"https://api.github.com/users/henriknyman/orgs","repos_url":"https://api.github.com/users/henriknyman/repos","events_url":"https://api.github.com/users/henriknyman/events{/privacy}","received_events_url":"https://api.github.com/users/henriknyman/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-03T00:15:35Z","updated_at":"2015-12-04T16:22:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42e7b576fcc2004cb5e74666d762b89022ce4dda","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6014/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6014/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/6014/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/47e108456d99a3f6080235b26c6011a814e635b8","head":{"label":"henriknyman:3.0-more-shortestpath-doc","ref":"3.0-more-shortestpath-doc","sha":"47e108456d99a3f6080235b26c6011a814e635b8","user":{"login":"henriknyman","id":13960026,"avatar_url":"https://avatars.githubusercontent.com/u/13960026?v=3","gravatar_id":"","url":"https://api.github.com/users/henriknyman","html_url":"https://github.com/henriknyman","followers_url":"https://api.github.com/users/henriknyman/followers","following_url":"https://api.github.com/users/henriknyman/following{/other_user}","gists_url":"https://api.github.com/users/henriknyman/gists{/gist_id}","starred_url":"https://api.github.com/users/henriknyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henriknyman/subscriptions","organizations_url":"https://api.github.com/users/henriknyman/orgs","repos_url":"https://api.github.com/users/henriknyman/repos","events_url":"https://api.github.com/users/henriknyman/events{/privacy}","received_events_url":"https://api.github.com/users/henriknyman/received_events","type":"User","site_admin":false},"repo":{"id":41737676,"name":"neo4j","full_name":"henriknyman/neo4j","owner":{"login":"henriknyman","id":13960026,"avatar_url":"https://avatars.githubusercontent.com/u/13960026?v=3","gravatar_id":"","url":"https://api.github.com/users/henriknyman","html_url":"https://github.com/henriknyman","followers_url":"https://api.github.com/users/henriknyman/followers","following_url":"https://api.github.com/users/henriknyman/following{/other_user}","gists_url":"https://api.github.com/users/henriknyman/gists{/gist_id}","starred_url":"https://api.github.com/users/henriknyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henriknyman/subscriptions","organizations_url":"https://api.github.com/users/henriknyman/orgs","repos_url":"https://api.github.com/users/henriknyman/repos","events_url":"https://api.github.com/users/henriknyman/events{/privacy}","received_events_url":"https://api.github.com/users/henriknyman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henriknyman/neo4j","description":"Graphs for Everyone","fork":true,"url":"https://api.github.com/repos/henriknyman/neo4j","forks_url":"https://api.github.com/repos/henriknyman/neo4j/forks","keys_url":"https://api.github.com/repos/henriknyman/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henriknyman/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henriknyman/neo4j/teams","hooks_url":"https://api.github.com/repos/henriknyman/neo4j/hooks","issue_events_url":"https://api.github.com/repos/henriknyman/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/henriknyman/neo4j/events","assignees_url":"https://api.github.com/repos/henriknyman/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/henriknyman/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/henriknyman/neo4j/tags","blobs_url":"https://api.github.com/repos/henriknyman/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henriknyman/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henriknyman/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/henriknyman/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henriknyman/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/henriknyman/neo4j/languages","stargazers_url":"https://api.github.com/repos/henriknyman/neo4j/stargazers","contributors_url":"https://api.github.com/repos/henriknyman/neo4j/contributors","subscribers_url":"https://api.github.com/repos/henriknyman/neo4j/subscribers","subscription_url":"https://api.github.com/repos/henriknyman/neo4j/subscription","commits_url":"https://api.github.com/repos/henriknyman/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/henriknyman/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/henriknyman/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/henriknyman/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/henriknyman/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/henriknyman/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henriknyman/neo4j/merges","archive_url":"https://api.github.com/repos/henriknyman/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henriknyman/neo4j/downloads","issues_url":"https://api.github.com/repos/henriknyman/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/henriknyman/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/henriknyman/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/henriknyman/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henriknyman/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/henriknyman/neo4j/releases{/id}","created_at":"2015-09-01T12:39:03Z","updated_at":"2015-09-01T12:39:28Z","pushed_at":"2015-12-04T14:17:43Z","git_url":"git://github.com/henriknyman/neo4j.git","ssh_url":"git@github.com:henriknyman/neo4j.git","clone_url":"https://github.com/henriknyman/neo4j.git","svn_url":"https://github.com/henriknyman/neo4j","homepage":"http://neo4j.com","size":267130,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.3"}},"base":{"label":"neo4j:3.0","ref":"3.0","sha":"f3bd679cd89b8692690deea89a01134158178a50","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","created_at":"2012-11-12T08:46:15Z","updated_at":"2015-12-04T16:09:56Z","pushed_at":"2015-12-04T16:16:03Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.com","size":312831,"stargazers_count":2168,"watchers_count":2168,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":800,"mirror_url":null,"open_issues_count":495,"forks":800,"open_issues":495,"watchers":2168,"default_branch":"3.0"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6014"},"html":{"href":"https://github.com/neo4j/neo4j/pull/6014"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/6014"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/6014/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6014/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6014/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/47e108456d99a3f6080235b26c6011a814e635b8"}}}}