Return nodes based on number of connections?

I've been looking at neo4j - how far off am i in thinking that this is a similar concept, but nicely packaged to fit into mysql?

I'm interested in finding proximity of nodes to each other - for example (all connections are bidirectional)

Server 1 <-> Server 2
Server 1 <-> Server 3
Server 3 <-> Server 4
Server 3 <-> Server 5
Server 5 <-> Server 6

What i would then like to do is say show me all servers that are 1 connection away - e.g. for server 1, then servers 2 & 3 are only 1 connection away. I'd also like to say show me all servers that are 2 connections away - e.g. for server 1, then servers 4 & 5 are two connections away (via node 3). I'd also like to be able to say show me all that are 1 or 2 connections away, i.e. 2,3,4,5 (for server 1)

Is this possible? How many connections from the origin point would this work for - as in some cases our servers may be interconnected over 8 connections.

Look forward to downloading it and trying it out. Also, congratulations on actually putting your support prices up for all to see - makes it much easier to see if it's worth investing the time looking at the product if we can see in advance how much support is likely to cost.

Returning select vertices.

It would be very possible to find vertices which are a specific distance away from a starting point with OQGRAPH. You simply need to construct something like the following query.

SELECT linkid FROM graph
WHERE latch=2 AND origid=1 AND ( weight=1 OR weight=2 )

for example:


mysql> CREATE TABLE graph (
-> latch SMALLINT UNSIGNED NULL,
-> origid BIGINT UNSIGNED NULL,
-> destid BIGINT UNSIGNED NULL,
-> weight DOUBLE NULL,
-> seq BIGINT UNSIGNED NULL,
-> linkid BIGINT UNSIGNED NULL,
-> KEY (latch, origid, destid) USING HASH,
-> KEY (latch, destid, origid) USING HASH
-> ) ENGINE=OQGRAPH;
Query OK, 0 rows affected (0.07 sec)

mysql> INSERT INTO graph (origid,destid) VALUES
-> (1,2),(2,1),
-> (1,3),(3,1),
-> (3,4),(4,3),
-> (3,5),(5,3),
-> (5,6),(6,5);
Query OK, 10 rows affected (0.00 sec)
Records: 10 Duplicates: 0 Warnings: 0

mysql> SELECT linkid FROM graph WHERE latch=2 AND origid=1 AND weight=1;
+--------+
| linkid |
+--------+
| 3 |
| 2 |
+--------+
2 rows in set (0.02 sec)

mysql> SELECT linkid FROM graph WHERE latch=2 AND origid=1 AND weight=2;
+--------+
| linkid |
+--------+
| 5 |
| 4 |
+--------+
2 rows in set (0.00 sec)

mysql> SELECT linkid FROM graph WHERE latch=2 AND origid=1 AND (weight=1 OR weight=2);
+--------+
| linkid |
+--------+
| 5 |
| 4 |
| 3 |
| 2 |
+--------+
4 rows in set (0.00 sec)

sounds like just the ticket -

sounds like just the ticket - can't wait to get my sticky mitts on the plugin for mysql 5.1 to give it a go..