#-- The following line would hang mysqld currently, see bug https://bugs.launchpad.net/oqgraph/+bug/1195735
#-- SELECT * FROM graph;
FLUSHTABLES;
TRUNCATETABLEgraph_base;
DROPTABLEgraph_base;
DROPTABLEgraph;
#-- Reminder - the basic spec is at http://openquery.com/graph/doc
#-- Query edges stored in graph engine (latch=NULL)
#-- SELECT * FROM foo;
#-- Results:
#-- vertex id for origin of edge in origid column.
#-- vertex id for destination of edge in destid column.
#-- weight of edge in weight column.
#-- Essentially this returns the values (origid,destid pairs with optional weight) you put in, in this mode OQGRAPH looks very close to a real table. But it also does nothing special, it's just store/retrieve for those columns. The other columns will be returned as NULL.
#--
#-- Query vertices stored in graph engine (latch=0)
#-- SELECT * FROM foo WHERE latch = 0;
#-- Results:
#-- vertex id in linkid column
#--
#-- Query out-edges for vertex (latch=0 AND origid=N)
#-- SELECT * FROM foo WHERE latch = 0 AND origid = 2;
#-- Results:
#-- vertex id in linkid column
#-- edge weight in weight column
#--
#-- Query in-edges for vertex (latch=0 AND destid=N)
#-- SELECT * FROM foo WHERE latch = 0 AND destid = 6;
#-- Results:
#-- vertex id in linkid column
#-- edge weight in weight column
#--
#-- Dijkstra's shortest path algorithm (latch=1)
#-- Find shortest path:
#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1 AND destid = 6;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id of the current step in linkid column.
#-- weight of traversed edge in weight column.
#-- step counter in seq column, so you can sort and use the result (starting at step 0).
#-- Example: SELECT GROUP_CONCAT(linkid ORDER BY seq) ...
#--
#-- Find reachable vertices:
#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id in linkid column.
#-- aggregate of weights in weight column.
#--
#-- Find originating vertices:
#-- SELECT * FROM foo WHERE latch = 1 AND destid = 6;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id in linkid column.
#-- aggregate of weights in weight column.
#--
#-- Breadth-first search (latch=2, assumes that each vertex is weight 1)
#-- Find shortest path:
#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1 AND destid = 6;
#-- Results:
#-- vertex id in linkid column.
#-- weight column = 1 for each hop.
#--
#-- Find reachable vertices:
#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1;
#-- Results:
#-- vertex id in linkid column.
#-- computed number of hops in weight column.
#--
#-- Find originating vertices:
#-- SELECT * FROM foo WHERE latch = 2 AND destid = 6;
#-- The following line would hang mysqld currently, see bug https://bugs.launchpad.net/oqgraph/+bug/1195735
#-- SELECT * FROM graph;
FLUSHTABLES;
TRUNCATETABLEgraph_base;
DROPTABLEgraph_base;
DROPTABLEgraph;
#-- Reminder - the basic spec is at http://openquery.com/graph/doc
#-- Query edges stored in graph engine (latch=NULL)
#-- SELECT * FROM foo;
#-- Results:
#-- vertex id for origin of edge in origid column.
#-- vertex id for destination of edge in destid column.
#-- weight of edge in weight column.
#-- Essentially this returns the values (origid,destid pairs with optional weight) you put in, in this mode OQGRAPH looks very close to a real table. But it also does nothing special, it's just store/retrieve for those columns. The other columns will be returned as NULL.
#--
#-- Query vertices stored in graph engine (latch=0)
#-- SELECT * FROM foo WHERE latch = 0;
#-- Results:
#-- vertex id in linkid column
#--
#-- Query out-edges for vertex (latch=0 AND origid=N)
#-- SELECT * FROM foo WHERE latch = 0 AND origid = 2;
#-- Results:
#-- vertex id in linkid column
#-- edge weight in weight column
#--
#-- Query in-edges for vertex (latch=0 AND destid=N)
#-- SELECT * FROM foo WHERE latch = 0 AND destid = 6;
#-- Results:
#-- vertex id in linkid column
#-- edge weight in weight column
#--
#-- Dijkstra's shortest path algorithm (latch=1)
#-- Find shortest path:
#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1 AND destid = 6;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id of the current step in linkid column.
#-- weight of traversed edge in weight column.
#-- step counter in seq column, so you can sort and use the result (starting at step 0).
#-- Example: SELECT GROUP_CONCAT(linkid ORDER BY seq) ...
#--
#-- Find reachable vertices:
#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id in linkid column.
#-- aggregate of weights in weight column.
#--
#-- Find originating vertices:
#-- SELECT * FROM foo WHERE latch = 1 AND destid = 6;
#-- Results:
#-- latch, origid, destid are same as input.
#-- vertex id in linkid column.
#-- aggregate of weights in weight column.
#--
#-- Breadth-first search (latch=2, assumes that each vertex is weight 1)
#-- Find shortest path:
#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1 AND destid = 6;
#-- Results:
#-- vertex id in linkid column.
#-- weight column = 1 for each hop.
#--
#-- Find reachable vertices:
#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1;
#-- Results:
#-- vertex id in linkid column.
#-- computed number of hops in weight column.
#--
#-- Find originating vertices:
#-- SELECT * FROM foo WHERE latch = 2 AND destid = 6;