Skip to content
New issue

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

Kruskal 算法中保存每个结点终点的数组大小初始化错误 #8

Open
tuyamanke opened this issue Jan 6, 2020 · 0 comments

Comments

@tuyamanke
Copy link

int[] vends = new int[mEdgNum]; // 用于保存"已有最小生成树"中每个顶点在该最小树中的终点。

此数组初始化大小应该为顶点个数,而非边条数,因为在无向连通图中,边的条数最小可以为顶点个数减一(此时该无向连通图就是一棵树),故当一个无向连通图本身就是一棵树时,获取索引最大的顶点的终点,会有数组越界的异常。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant