(output = (value) => console.log(value))
| 19 | } |
| 20 | |
| 21 | printGraph(output = (value) => console.log(value)) { |
| 22 | const keys = Object.keys(this.adjacencyMap) |
| 23 | for (const i of keys) { |
| 24 | const values = this.adjacencyMap[i] |
| 25 | let vertex = '' |
| 26 | for (const j of values) { |
| 27 | vertex += j + ' ' |
| 28 | } |
| 29 | output(i + ' -> ' + vertex) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Prints the Breadth first traversal of the graph from source. |
no test coverage detected