mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 23:21:18 +08:00
Fix kruskal's exception message for directed graph (#138)
This commit is contained in:
parent
88bbfdc470
commit
941feda305
@ -10,7 +10,7 @@ export default function kruskal(graph) {
|
|||||||
// It should fire error if graph is directed since the algorithm works only
|
// It should fire error if graph is directed since the algorithm works only
|
||||||
// for undirected graphs.
|
// for undirected graphs.
|
||||||
if (graph.isDirected) {
|
if (graph.isDirected) {
|
||||||
throw new Error('Prim\'s algorithms works only for undirected graphs');
|
throw new Error('Kruskal\'s algorithms works only for undirected graphs');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init new graph that will contain minimum spanning tree of original graph.
|
// Init new graph that will contain minimum spanning tree of original graph.
|
||||||
|
Loading…
Reference in New Issue
Block a user