Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
shortestPath with findSinglePath
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mirko Nasato  
View profile  
 More options Apr 29 2012, 5:44 am
From: Mirko Nasato <mirko.nas...@gmail.com>
Date: Sun, 29 Apr 2012 02:44:51 -0700 (PDT)
Local: Sun, Apr 29 2012 5:44 am
Subject: shortestPath with findSinglePath

Hi all,

Given

  PathFinder<Path> finder = GraphAlgoFactory.shortestPath(expander, 4);
  finder.findSinglePath(startNode, endNode);

seems like findSinglePath is not guaranteed to find the *shortest* path, it
just returns the first path it finds with length <= 4.

So it can return a path of length 4 even though one of length 3 exists -
and can be found using findAllPaths instead. Is that by design?

(I'm using Neo4j 1.7.)

Thanks

Mirko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mattias Persson  
View profile  
 More options Apr 29 2012, 8:34 am
From: Mattias Persson <matt...@neotechnology.com>
Date: Sun, 29 Apr 2012 14:34:51 +0200
Local: Sun, Apr 29 2012 8:34 am
Subject: Re: [Neo4j] shortestPath with findSinglePath

Have you got an example where it returns a path that isn't the shortest?
findSinglePath will by design return the shortest path. The maxLength (=4
in your case) parameter is just to limit how far it is allowed to go if it
doesn't find any shorter path along the way.

2012/4/29 Mirko Nasato <mirko.nas...@gmail.com>

--
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mirko Nasato  
View profile  
 More options Apr 29 2012, 9:41 am
From: Mirko Nasato <mirko.nas...@gmail.com>
Date: Sun, 29 Apr 2012 06:41:14 -0700 (PDT)
Local: Sun, Apr 29 2012 9:41 am
Subject: Re: [Neo4j] shortestPath with findSinglePath

Hi Mattias,

Yes I did encounter an actual example where findSinglePath doesn't seem to
return the shortest path. In fact it returns a path of length 4 with
maxDepth = 4, and of length 3 with maxDepth = 3.

I have a graph of Wikipedia pages and their links. Recreating it is a bit
involved because you need a Wikipedia dump to start with, but my code is on
GitHub <https://github.com/mirkonasato/graphipedia>.

Here's what I see (using Groovy just for its interactive shell)

  groovy:000> println graphipedia.findPath("Microsoft", "Hotels.com",
4).join(" --> ")
  Microsoft --> Windows 7 --> Steven Sinofsky --> Cornell University -->
Hotels.com

  groovy:000> println graphipedia.findPath("Microsoft", "Hotels.com",
3).join(" --> ")
  Microsoft --> Human Rights Campaign --> Cornell University --> Hotels.com

  groovy:000> graphipedia.findShortestPaths("Microsoft", "Hotels.com",
4).each { path -> println path.join(" --> ") }
  Microsoft --> Bill Gates --> Cornell University --> Hotels.com
  Microsoft --> Human Rights Campaign --> Cornell University --> Hotels.com

In GraphipediaService<https://github.com/mirkonasato/graphipedia/blob/master/graphipedia-qu...>findPath calls findSinglePath and findShortestPaths calls findAllPaths.

Thanks

Mirko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mirko Nasato  
View profile  
 More options Apr 30 2012, 7:08 am
From: Mirko Nasato <mirko.nas...@gmail.com>
Date: Mon, 30 Apr 2012 04:08:56 -0700 (PDT)
Local: Mon, Apr 30 2012 7:08 am
Subject: Re: [Neo4j] shortestPath with findSinglePath
 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mattias Persson  
View profile  
 More options May 1 2012, 5:13 pm
From: Mattias Persson <matt...@neotechnology.com>
Date: Tue, 1 May 2012 23:13:16 +0200
Local: Tues, May 1 2012 5:13 pm
Subject: Re: [Neo4j] shortestPath with findSinglePath

Thanks, I'll have a look at it as it seems to me like you've found a bug!

2012/4/30 Mirko Nasato <mirko.nas...@gmail.com>

--
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »