thanks craig ----- Mensaje original ----- De: "Craig Taverner" <[email protected]> Para: "Neo4j user discussions" <[email protected]> Enviados: Lunes, 14 de Febrero 2011 10:39:32 (GMT-0500) Auto-Detected Asunto: Re: [Neo4j] about relationship
I thought he was asking 'if I have the two nodes, how do I get the edge?'. In that case iterate over all relationships from the one node using nodeA.getRelationships()<http://api.neo4j.org/current/org/neo4j/graphdb/Node.html#getRelationships()> and test the end node to see if it is nodeB. On Mon, Feb 14, 2011 at 10:18 AM, Mattias Persson <[email protected] > wrote: > You mean in the most efficient way? Currently you'll have to go with a > relationship index if you have many edges and would like to do a fast > lookup > for a relationship between two nodes. You can index relationships just as > you do nodes: > > RelationshipIndex index = graphDb.index().forRelationships( > "my-relationships" ); > index.add( myRelationship, "myKey", "myValue" ); > ... > // Either if you query for a specific property: > index.get( "myKey", "myValue", startNode, endNode ); > // Or if you just query using the nodes > index.get( null, null, startNode, endNode ); > > The other way is to loop relationships from one node and see if the > otherNode of those relationships matches. Might be slower though > > Best, > Mattias > > 2011/2/10 Jose Angel Inda Herrera <[email protected]> > > > > > hello list, > > How to get an edge in the graph (in this case a relationship) having the > > two nodes of this relationship, > > > > thank beforhand > > _______________________________________________ > > Neo4j mailing list > > [email protected] > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > -- > Mattias Persson, [[email protected]] > Hacker, Neo Technology > www.neotechnology.com > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

