Hacker News new | ask | show | jobs
by rotten 2207 days ago
A Graph in the computer science world is a type of data model. There are many problems that are easier to solve with that kind of data model. For example: What is the shortest path between two locations on a map? (ie, every time you ask google for directions) What is the single point of failure in this network? How am I connected to pbg on Linked In? How are these financial crimes connected? Who is the biggest "influencer" in my facebook network? How do diseases spread? How do forest fires spread? I want to make a phone call, how does it get routed (with old telephone switch technology) across the country? I have 10 rooms, 30 speakers, and 1000 attendees in my conference. How do I arrange the speakers and conference rooms for an optimal conference schedule? I have a bunch of pilots who speak different languages and are qualified to fly on a variety of aircraft how do I maximize the number of planes in the air at any one time? How do I send my garbage trucks out to collect the garbage and use the least amount of fuel?
1 comments

I get graphs and perhaps some graph algos (maximal flow etc) but I've never used a graph DB. Is this really how it works, cos what you're describing sounds more like some kind of generic-optimiser-in-a-box
I'd say it's more about query language, and what types of queries the DB is optimized for. Graph DBs come with query languages that let you directly ask questions like "starting from node $foo, select all nodes and edges that lead to node $bar, but only for paths consisting of edges with property $xyz > 42".

An example from Neo4J documentation:

  MATCH p =(charlie:Person)-[* { blocked:false }]-(martin:Person)
  WHERE charlie.name = 'Charlie Sheen' AND martin.name = 'Martin Sheen'
  RETURN p
which, per documentation, "returns the paths between 'Charlie Sheen' and 'Martin Sheen' where all relationships have the blocked property set to false".

https://neo4j.com/docs/cypher-manual/current/clauses/match/#...

Graph DBs are designed for modelling your data as nodes with properties, connecting by directed edges, with properties, to another nodes; they're also internally optimized for doing such queries.