We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 添加顶点 addVertex(val) { // 添加点 this.vertexes.push(val) // 添加点的关系 采用邻接矩阵法 结构用 Map this.adjList.set(val, []) } // 添加边 addEdge(val1, val2) { // 添加边需要传入两个顶点,因为边是两个顶点之间的边,边不可能单独存在。 // 这里实现的是无向图,所以这里不考虑方向问题 this.adjList.get(val1).push(val2) this.adjList.get(val2).push(val1) }
new Dictionary()
class Map
class Graph { constructor() { this.vertexes = []; // 存储顶点 this.adjList = new Dictionay(); //存储边信息 } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
new Dictionary()
,但字典那章写的是class Map
,感觉可以统一一下The text was updated successfully, but these errors were encountered: