[Neo4j] Limiting the number of returned paths or finding next shortest path
Hi guys, I have a decent size graph (2.5M nodes, 8M relationships) and am interested in finding paths between two nodes. I am using the REST API since the app I am working on is developed in .NET. Due to the nature of the graph the paths can be quite long, so I am using 8 for the max depth parameter. Searching for the shortest path between two nodes is quite fast. On the other hand, searching for allSimplePaths is really slow. Up to a max depth value of 5 it is still ok, but going further makes it very slow and as I mentioned already, I can have meaningful connections of depth up to 8. I think the reason might be because there may be too many paths between the nodes. Is there any way I can tell the API to return not all paths, but rather just the first 3-4-5 it finds? I think that might speed up things significantly and I don't really need to show more paths than that. Alternatively, if I can ask Neo4j for the next shortest path, after the one I already got, that would also be a great solution. However, I don't expect that there's an easy way to do that. Thanks a lot in advance!! Best regards, Petar -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Limiting the number of returned paths or finding next shortest path
Mmh, there is an implementation for this in https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if that is what you want, we then should expose this as part of the REST API right? What REST call are you using right now? Please raise a feature request on this at https://github.com/neo4j/community/issues, would be great. Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/- Öresund - Innovation happens HERE. On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote: Hi guys, I have a decent size graph (2.5M nodes, 8M relationships) and am interested in finding paths between two nodes. I am using the REST API since the app I am working on is developed in .NET. Due to the nature of the graph the paths can be quite long, so I am using 8 for the max depth parameter. Searching for the shortest path between two nodes is quite fast. On the other hand, searching for allSimplePaths is really slow. Up to a max depth value of 5 it is still ok, but going further makes it very slow and as I mentioned already, I can have meaningful connections of depth up to 8. I think the reason might be because there may be too many paths between the nodes. Is there any way I can tell the API to return not all paths, but rather just the first 3-4-5 it finds? I think that might speed up things significantly and I don't really need to show more paths than that. Alternatively, if I can ask Neo4j for the next shortest path, after the one I already got, that would also be a great solution. However, I don't expect that there's an easy way to do that. Thanks a lot in advance!! Best regards, Petar -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Limiting the number of returned paths or finding next shortest path
Hi Peter, thanks for the swift response. Just a quick question about the ShortestPath path finder -- does it return paths of only the same (shortest) length or does it sort all simple paths according to their length. I am almost certain it does the former, but if it's the latter then that's exactly what I need. If not then I think this effect can be achieved by first running shortestPath and then pathsWithLength for all the lengths up to maxDepth. Not optimal, but would do the job. However, pathsWithLength is also not exposed via the API. Otherwise this looks exactly like what I'm looking for. Would be great to have them as part of the API. The API call I am using now is: POST http://localhost:7474/db/data/node/nodeid/paths Data: { to: http://localhost:7474/db/data/node/nodeid, max_depth: 8, relationships: [{ type: reltype }], algorithm: shortestPath } I created a feature request at: https://github.com/neo4j/community/issues/99 Thanks a lot! Best regards, Petar On Mon, Nov 14, 2011 at 10:11 PM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Mmh, there is an implementation for this in https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if that is what you want, we then should expose this as part of the REST API right? What REST call are you using right now? Please raise a feature request on this at https://github.com/neo4j/community/issues, would be great. Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/- Öresund - Innovation happens HERE. On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote: Hi guys, I have a decent size graph (2.5M nodes, 8M relationships) and am interested in finding paths between two nodes. I am using the REST API since the app I am working on is developed in .NET. Due to the nature of the graph the paths can be quite long, so I am using 8 for the max depth parameter. Searching for the shortest path between two nodes is quite fast. On the other hand, searching for allSimplePaths is really slow. Up to a max depth value of 5 it is still ok, but going further makes it very slow and as I mentioned already, I can have meaningful connections of depth up to 8. I think the reason might be because there may be too many paths between the nodes. Is there any way I can tell the API to return not all paths, but rather just the first 3-4-5 it finds? I think that might speed up things significantly and I don't really need to show more paths than that. Alternatively, if I can ask Neo4j for the next shortest path, after the one I already got, that would also be a great solution. However, I don't expect that there's an easy way to do that. Thanks a lot in advance!! Best regards, Petar -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Petar Dobrev Engineer Philanthropedia http://www.myphilanthropedia.org ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Limiting the number of returned paths or finding next shortest path
Thanks Petar, will get on it as soon as I have time. Good contribution! Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/- Öresund - Innovation happens HERE. On Mon, Nov 14, 2011 at 10:31 PM, Petar Dobrev petar.dob...@myphilanthropedia.org wrote: Hi Peter, thanks for the swift response. Just a quick question about the ShortestPath path finder -- does it return paths of only the same (shortest) length or does it sort all simple paths according to their length. I am almost certain it does the former, but if it's the latter then that's exactly what I need. If not then I think this effect can be achieved by first running shortestPath and then pathsWithLength for all the lengths up to maxDepth. Not optimal, but would do the job. However, pathsWithLength is also not exposed via the API. Otherwise this looks exactly like what I'm looking for. Would be great to have them as part of the API. The API call I am using now is: POST http://localhost:7474/db/data/node/nodeid/paths Data: { to: http://localhost:7474/db/data/node/nodeid, max_depth: 8, relationships: [{ type: reltype }], algorithm: shortestPath } I created a feature request at: https://github.com/neo4j/community/issues/99 Thanks a lot! Best regards, Petar On Mon, Nov 14, 2011 at 10:11 PM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Mmh, there is an implementation for this in https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if that is what you want, we then should expose this as part of the REST API right? What REST call are you using right now? Please raise a feature request on this at https://github.com/neo4j/community/issues, would be great. Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/- Öresund - Innovation happens HERE. On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote: Hi guys, I have a decent size graph (2.5M nodes, 8M relationships) and am interested in finding paths between two nodes. I am using the REST API since the app I am working on is developed in .NET. Due to the nature of the graph the paths can be quite long, so I am using 8 for the max depth parameter. Searching for the shortest path between two nodes is quite fast. On the other hand, searching for allSimplePaths is really slow. Up to a max depth value of 5 it is still ok, but going further makes it very slow and as I mentioned already, I can have meaningful connections of depth up to 8. I think the reason might be because there may be too many paths between the nodes. Is there any way I can tell the API to return not all paths, but rather just the first 3-4-5 it finds? I think that might speed up things significantly and I don't really need to show more paths than that. Alternatively, if I can ask Neo4j for the next shortest path, after the one I already got, that would also be a great solution. However, I don't expect that there's an easy way to do that. Thanks a lot in advance!! Best regards, Petar -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Petar Dobrev Engineer Philanthropedia http://www.myphilanthropedia.org ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user