/// <summary> /// <para><paramref name="from"/> からの最短経路長をダイクストラ法で求める。</para> /// <para>計算量: O( (|E| + |V|) log |V| )</para> /// </summary> public static T[] Dijkstra <T, TOp, TNode, TEdge>(this IWGraph <T, TOp, TNode, TEdge> graph, int from) where T : struct where TOp : struct, INumOperator <T> where TNode : IGraphNode <TEdge> where TEdge : IWGraphEdge <T> { TOp op = default; var graphArr = graph.AsArray(); var INF = op.MaxValue; var res = new T[graphArr.Length]; System.Array.Fill(res, INF); res[from] = default; var used = new bool[graphArr.Length]; int count = 0; var remains = new PriorityQueueDijkstra <T, TOp>(graphArr.Length); remains.Enqueue(default, from);
public DebugView(PriorityQueueDijkstra <TKey, TKOp> pq) { this.pq = pq; }