Graph

constructor(isWeighted: Boolean = true)

Parameters

isWeighted

Indicates whether it uses weighted or unweighted edges. Traversal algorithms like BFS and DFS operate on unweighted graphs, while minimum cost algorithms like Dijkstra, Floyd Warshall and Prims are based on weighted edges