Skip to content

Conversation

@cxzhong
Copy link
Contributor

@cxzhong cxzhong commented Nov 26, 2025

  • fix some variables which are not init
  • fix some compare with different types of integers.
  • fix some mismath like def to cpdef to match the header file

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not check all default values you assigned, in particular in code/methods that I don't know.


cdef int i
cdef int x_min = 0
cdef int x_max = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is something wrong in this method. if xmax is None, then x_max is set to self.n. Otherwise, it will remain to the default value you assigned, that is 0.
Why not doing like:

if xmin is None:
    xmin = 0
if xmax is None:
    xmax = self.n
for i in range(xmin, xmax):
...

# (of length shortest_path_length).
cdef int meeting_vertex = -1
cdef double shortest_path_length
cdef double shortest_path_length = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this cannot be initialized to 0. IT should be +oo

# (of length shortest_path_length).
cdef int meeting_vertex = -1
cdef double shortest_path_length
cdef double shortest_path_length = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be initialized to large value +oo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants