- pathDijkstra(graph, sourceOrId): {
distances: Map<string, number>;
pathTo: ((id: string) => Readonly<{
id: string;
weight?: number;
}>[]);
previous: Map<string, null | Readonly<{
id: string;
out: readonly Readonly<{
id: string;
weight?: number;
}>[];
}>>;
} Parameters
- graph: Readonly<{
vertices: IMapImmutable<string, Readonly<{
id: string;
out: readonly Readonly<{
id: string;
weight?: number;
}>[];
}>>;
}> - sourceOrId: string | Readonly<{
id: string;
out: readonly Readonly<{
id: string;
weight?: number;
}>[];
}>
Returns {
distances: Map<string, number>;
pathTo: ((id: string) => Readonly<{
id: string;
weight?: number;
}>[]);
previous: Map<string, null | Readonly<{
id: string;
out: readonly Readonly<{
id: string;
weight?: number;
}>[];
}>>;
}
distances: Map<string, number>
pathTo: ((id: string) => Readonly<{
id: string;
weight?: number;
}>[])
- (id): Readonly<{
id: string;
weight?: number;
}>[] Returns Readonly<{
id: string;
weight?: number;
}>[]
previous: Map<string, null | Readonly<{
id: string;
out: readonly Readonly<{
id: string;
weight?: number;
}>[];
}>>
Compute shortest distance from the source vertex to the rest of the graph.