()
| 40 | } |
| 41 | |
| 42 | toString() { |
| 43 | let s = ''; |
| 44 | this.#vertices.forEach(vertex => { |
| 45 | s += `${vertex} -> `; |
| 46 | this.#adjList.get(vertex).forEach(neighbor => { |
| 47 | s += `${neighbor} `; |
| 48 | }); |
| 49 | s += '\n'; |
| 50 | }); |
| 51 | return s; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | module.exports = Graph; |
no test coverage detected