This is a bit of a guess as I haven't worked with the REST API directly
yet, but is the 'direction' parameter mandatory? And if so, would it
take 'both' instead of 'out', like with the other APIs? Failing that,
Cypher has the shortestPath function[1] which doesn't require a
direction. That's also another way to invoke the algorithm.

[1] http://docs.neo4j.org/chunked/milestone/query-match.html#_shortest_path

On 12/24/2013 07:55 PM, Abhishek Gupta wrote:
> Thanks for such an insightful comment, and the attached link. I was able
> to write my query as a directed search using certain structural properties. 
> 
> |
> MATCH p=((alpha
> {name:"alpha_name"})-[r1]->(node1)-[r2]->(node2)<-[r3]-(node3)<-[r4]-(beta{name:"beta_name"}))RETURN
> p;
> |
> 
> But I am facing another problem related to my original problem. My
> actual problem statement is to find shortest path in the weighted
> undirected graph.
> 
> Firstly, if I want to use Dijakstra's algorithm as given
> on http://docs.neo4j.org/chunked/milestone/rest-api-graph-algos.html
> then they operate on the directed graph.
> Q: If I have to use these algorithms than do I have to make duplicate
> edges, or is there any other solution?
> 
> Secondly, py2neo doesn't seem to support these algorithms.
> Q: Is rest api and java based solutions only approach to invoke these
> algorithms?
> 
> Thanks again for replying.
> Abhishek
> 
> 
> On Tuesday, 24 December 2013 21:56:44 UTC+5:30, Johannes Mockenhaupt wrote:
> 
>     As you probably know, Neo4j only supports directed relationship. The
>     idea is to make you think about what the direction means for your
>     domain. While at creation time you have to specify a direction, you're
>     free to ignore direction at query time - you don't have to create a
>     second relationship going backwards just for queries (or speed).
>     This is
>     what you most often do. However, in some cases, when you really want to
>     make the point that a relation is unidirectional in termns of the
>     domain, you'd create a second relationship with the inverse direction.
>     At first, this felt like a workaround to me, but now I really like that
>     I'm somewhat forced to thing about what the direction means for the
>     domain.
>     For a practical example, you might look at the second picture at
>     this[1]
>     (okay, my) graph gist. At the bottom right, there are the two modes
>     that
>     "Spring Data Neo4j" supports, which are both an alternative to each
>     other. Here it makes sense to have two relationships back and forth, as
>     they're an alternative to each other in terms of the domain and also
>     allow me to do a directed query like "Show me the alternatives to X",
>     where each mode shall list the other as an alternative.
> 
>     Hope that helps, I wasn't sure whether you're asking for a best
>     practice
>     way to insert relationships using Python or generally more in the sense
>     of domain modelling. I've obvisouly picked the second interpretation to
>     answer to and it probably won't hurt to consider those aspects in any
>     case :-)
> 
>     [1]
>     
> http://gist.neo4j.org/?github-jotomo/neo4j-gist-challenge//learning-graph/learning-graph.adoc
>     
> <http://gist.neo4j.org/?github-jotomo/neo4j-gist-challenge//learning-graph/learning-graph.adoc>
> 
> 
>     On 12/24/2013 05:02 PM, Abhishek Gupta wrote:
>     > What is the best way to create undirectional relationships in
>     neo4j? I
>     > am using neo4j, py2neo. Here is how I insert the nodes and the
>     > relationships:
>     >
>     > |
>     > index_name =db.get_or_create_index(neo4j.Node,"index_name")
>     >
>     > defcreate_node(name):
>     >  returnindex_name.get_or_create("name",name,{"name":name})
>     >
>     > definsert_triplet(triplet):
>     >  firstNode  =create_node(triplet[0])
>     >  secondNode =create_node(triplet[2])
>     >  chain =neo4j.Path(firstNode,triplet[1],secondNode)
>     >  path =chain.get_or_create(db)
>     > |
>     >
>     > Thanks in advance for replying.
>     >
>     > Regards
>     > Abhishek
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "Neo4j" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to [email protected] <javascript:>.
>     > For more options, visit https://groups.google.com/groups/opt_out
>     <https://groups.google.com/groups/opt_out>.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to