Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/neetcode-gh/leetcode
/ initGraph
Function
initGraph
javascript/0261-graph-valid-tree.js:19–22 ·
view source on GitHub ↗
(n)
Source
from the content-addressed store, hash-verified
17
};
18
19
var
initGraph = (n) => ({
20
graph:
new
Array(n).fill().map(() => []),
21
visited:
new
Set(),
22
});
23
24
var
buildGraph = (n, edges) => {
25
const
{ graph, visited } = initGraph(n);
Callers
1
buildGraph
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected