Which high sec system has the lowest average jump count to all of high sec?

Which high sec EVE system is the most central to high sec - or in other words, has the fewest average jumps to every other high sec system?

If possible, I would also like to know:

  • Which high sec system is most central to all other high sec regions (closest system in region)
  • Which high sec system is most central to all other high sec regions (center of each region)
  • Which high sec system is most central to all other systems
  • Which system is most central to all other systems

Info can be generated from http://community.eveonline.com/community/toolkit.asp.


I am not proficient in T-SQL, as any expert can assure you. That said, this information I think is correct (enough for me now anyway), but I would love to accept a better (more readable, more complete, etc) answer.

Excluding obvious island systems (low average and max jumps) manually, here are the top ten systems to base out of for rapid access to all high sec systems not in islands (106 island systems):

System      Avg Max
-------------------
Sivala      12  30
Uedama      12  31
Inaro       12  31
Kaaputenen  12  31
Kamio       12  31
Ikao        12  32
Niarja      12  32
Madirmilire 12  33
Ashab       12  34
Algogille   13  27

Below is what I ran (I called exec dbo.usp_Eve_BFS in another query). Please note that this T-SQL is hacked together from online tutorials by a T-SQL neophyte. It ran for 4:21 minutes on my machine.

CREATE PROCEDURE dbo.usp_Eve_BFS
AS
BEGIN
    SET XACT_ABORT ON
    BEGIN TRAN
    SET NOCOUNT ON;

    CREATE TABLE #Result (Id int NOT NULL PRIMARY KEY, Name nvarchar(100), Average int, Maximum int)
    INSERT INTO #Result (Id, Name) SELECT solarSystemID, solarSystemName FROM mapSolarSystems WHERE security >= 0.45

    DECLARE @StartNode int
    DECLARE c CURSOR FOR SELECT Id FROM #Result
    OPEN c
    FETCH NEXT FROM c INTO @StartNode

    WHILE @@FETCH_STATUS=0
    BEGIN
        CREATE TABLE #Discovered (Id int NOT NULL PRIMARY KEY, Parent int NULL, Depth int)
        INSERT INTO #Discovered (Id, parent, depth) VALUES (@StartNode, NULL, 0)

        WHILE @@ROWCOUNT > 0
        BEGIN
            INSERT INTO #Discovered (Id, Parent, Depth)
            SELECT toSolarSystemID, MAX(fromSolarSystemID), MIN(Depth) + 1
            FROM #Discovered d JOIN mapSolarSystemJumps ON d.Id = fromSolarSystemID
            JOIN #Result ON (mapSolarSystemJumps.toSolarSystemID = #Result.Id)
            WHERE toSolarSystemID NOT IN (SELECT Id From #Discovered)
            AND Depth = ( -- make sure the fromSolarSystemID matches the MIN(depth)!
                SELECT MIN(Depth) FROM #Discovered d JOIN mapSolarSystemJumps ON d.Id = fromSolarSystemID
                JOIN #Result ON (mapSolarSystemJumps.toSolarSystemID = #Result.Id)
                WHERE toSolarSystemID NOT IN (SELECT Id From #Discovered)
            )
            GROUP BY toSolarSystemID
        END;

        WITH BacktraceCTE(Id, Depth) AS
        (
            SELECT Id, Depth
            FROM #Discovered d
            WHERE d.Id = @StartNode
        UNION ALL
            SELECT d.Id, d.Depth
            FROM #Discovered d JOIN BacktraceCTE cte ON d.Parent = cte.Id
        )
        UPDATE #Result
        SET Average = a.Average, Maximum = a.Maximum
        FROM (SELECT AVG(Depth) AS Average, MAX(Depth) AS Maximum FROM BacktraceCTE) AS a
        WHERE #Result.Id = @StartNode

        DROP TABLE #Discovered

        FETCH NEXT FROM c INTO @StartNode
    END

    SELECT * FROM #Result ORDER BY Average, Maximum;
    DROP TABLE #Result

    COMMIT TRAN
    RETURN 0
END