Commit c378d9f
committed
Fix error in implementation of Erdos-Gallai condition in isgraphical
Fixes #400
Fix `isgraphical` function to correctly handle non-graphical sequences.
# Error in current implementation
`mindeg` is computed globally at the start using `min(i, sorted_degs[i])` for all indices. However, the Erdös-Gallai condition requires dynamically calculating `min(r, sorted_degs[i])` for vertices after the current index `r`.
# What changed
* Update the Erdös-Gallai condition check to calculate the sum of the minimum of r and the degrees of the vertices.
* Add a test case in `test/connectivity.jl` to verify that `isgraphical` returns false for the sequence [4,2,2,2,0].
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/JuliaGraphs/Graphs.jl/issues/400?shareId=XXXX-XXXX-XXXX-XXXX).1 parent 2ae1c18 commit c378d9f
2 files changed
+4
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | 808 | | |
814 | | - | |
815 | 809 | | |
816 | 810 | | |
817 | | - | |
818 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
819 | 814 | | |
820 | 815 | | |
821 | 816 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
0 commit comments