-
Notifications
You must be signed in to change notification settings - Fork 208
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
Adjacency Matrix: doc error for undirected graphs #323
Comments
I've also created a small python script to test for the idea and it prints OK:
|
You are correct if we are talking about exact numbers, but when analyzing an algorithm complexity and memory requirements only the biggest term is of interest. Look for Big O notation for more info. |
Ah I see, I thought it was an exact number and not Big-O notation and it wasn't explicitly specified (it also says Also, doesn't Anyway, thank you! If the documentation is written as intended, this issue can be closed according to me. |
You are correct here too. Maybe due to this reason the author didn't use Big-O. |
In the doc page for adjacency matrices there is an error for undirected graphs.
It says:
In particular,
This reduces the storage to (V²)/2
is wrong, since if you count the number of items in the Figure 2, you can see that there are 21 items for a graph of 6 vertices (instead of(6²)/2 = 36 / 2 = 18
).I believe the correct formula is
(V² + V) / 2
.For n = 1:
(1² + 1) / 2 = 2 / 2 = 1
For n = 2:
(2² + 2) / 2 = 6 / 2 = 3
For n = 6:
(6² + 6) / 2 = 42 / 2 = 21
The text was updated successfully, but these errors were encountered: