Hacker News new | ask | show | jobs
by rabidsnail 5961 days ago
Can you use neo4j to store weighted graphs? Looking at their api it doesn't seem like there's any way to specify edge weights (or any other metadata about edges).
1 comments

You can set properties (including weights, though not sure if you can define said weights in a tightly integrated manner - they're just an additional property) on nodes and edges ("relationships"). It's right there in the getting started guide's "Create a small graph" section:

http://wiki.neo4j.org/content/Getting_Started_Guide#Create_a...

Weights are treated like any other metadata.

There's a component that has some weighted shortest-path algorithms: http://wiki.neo4j.org/content/Graph-algo

Please let me know if you find anything that can handle negative edge weights well while efficiently tracking shortest paths. I've found some papers with efficient implementations for frequently updated edge weights, but haven't found anything implemented or accessible.