Best Way to Store/Access a Directed Graph

后端 未结 6 742
清酒与你
清酒与你 2021-02-01 09:14

I have around 3500 flood control facilities that I would like to represent as a network to determine flow paths (essentially a directed graph). I\'m currently using SqlServer an

6条回答
  •  名媛妹妹
    2021-02-01 09:55

    i think your data structure is fine (for SQL Server) but a CTE may not be the most efficient solution for your queries. You might try making a stored procedure that traverses the graph using a temp table as a queue instead, this should be more efficient.

    the temp table can also be used to eliminate cycles in the graph, though there shouldn't be any

提交回复
热议问题