Skip to content

Commit

Permalink
now works for no reason. apparently a cython bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
fxjung committed Aug 14, 2024
1 parent 6dbfe74 commit c6f46a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/ridepy/util/spaces_cython/boost_graph_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ class GraphSpace : public TransportSpace<vertex_t> {
GraphSpace(double velocity, vector<vertex_t> vertex_vec,
vector<Edge> edge_vec, vector<double> weight_vec)
: TransportSpace<vertex_t>(),
velocity(velocity), _g{vertex_vec.size()}, vertex2label{get(vertex_name,
_g)},
velocity(velocity),
_g{vertex_vec.size()},
vertex2label{get(vertex_name, _g)},
_distances(static_cast<int>(vertex_vec.size())),
_predecessors(static_cast<int>(vertex_vec.size())),
_weights{weight_vec}, edge2weight{get(edge_weight, _g)} {
_weights{weight_vec},
edge2weight{get(edge_weight, _g)} {
// this->vertex2label = get(vertex_name, this->_g);
// add vertex properties
int idx = 0;
Expand Down
12 changes: 6 additions & 6 deletions src/ridepy/util/spaces_cython/spaces.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,19 @@ cdef class Graph(TransportSpace):
self.loc_type = LocType.INT

if weights is None:
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[ulonglong](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges
<vector[ulonglong]>vertices,
<vector[pair[ulonglong, ulonglong]]>edges
)
else:
if isinstance(weights, (int, float)):
weights = it.repeat(float(weights), len(edges))

self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[ulonglong](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges,
<vector[ulonglong]>vertices,
<vector[pair[ulonglong, ulonglong]]>edges,
<vector[double]>weights
)

Expand Down

0 comments on commit c6f46a1

Please sign in to comment.