Not at all, you're not the first one to overlook that inheritance! 2010/1/28, Anton Popov <[email protected]>: > Thanks for a quick answer, Mattias. > > Sorry for a stupid questions, just haven't noticed the inheritance of > Relationship interface. > > On 28 January 2010 19:43, Mattias Persson <[email protected]> wrote: > >> Relationship has all the property methods, just like Node... they're >> actually on PropertyContainer (a common super interface to Node and >> Relationship) see >> http://api.neo4j.org/current/org/neo4j/graphdb/Relationship.html and >> http://api.neo4j.org/current/org/neo4j/graphdb/PropertyContainer.html >> for more information. >> >> So to manage the cost in a dijkstra algorithm you can use whatever >> property key, f.ex. "weight", like this: >> >> Relationship rel = ... // any relationship >> rel.setProperty( "weight", 4 ); >> >> And if you're using the Dijkstra algorithms in the "neo4j-graph-algo" >> component, http://components.neo4j.org/neo4j-graph-algo/ , you can >> instantiate it with a CostEvaluator instance something like this: >> >> new CostEvaluator<Integer>() >> { >> CostType getCost( Relationship relationship, boolean backwards ) >> { >> / TODO Handle backwards flag? >> return ( Integer ) relationship.getProperty( "weight", 1 ); >> } >> } >> >> ...and pass it to your Dijkstra algo instance. >> >> Is this what you were looking for? >> >> 2010/1/28 Anton Popov <[email protected]>: >> > Hello everyone, >> > >> > Is there any possibility to assign properties to Relations? >> > The matter is I want to try Dijkstra algorithm performance on some >> weighted >> > directed graph and don't know where to put weight actually... >> > >> > -- >> > Best regards, >> > Popov Anton >> > _______________________________________________ >> > Neo mailing list >> > [email protected] >> > https://lists.neo4j.org/mailman/listinfo/user >> > >> >> >> >> -- >> Mattias Persson, [[email protected]] >> Neo Technology, www.neotechnology.com >> _______________________________________________ >> Neo mailing list >> [email protected] >> https://lists.neo4j.org/mailman/listinfo/user >> > > > > -- > Best regards, > Popov Anton > _______________________________________________ > Neo mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user >
-- Mattias Persson, [[email protected]] Neo Technology, www.neotechnology.com _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

