This week, we start writing tests with pgtap! (yay) But before that, I realised that since we are not working with the main repository directly, it was very important to follow the correct coding convention before our code is officially merged to main pgrouting repo.

We are following the Google C++ Guide plus using the cpplint for style-check (which I wasn’t doing before). I modified the sloanOrdering.hpp file to call the pgrouting::sloan function in my ordering_process.cpp file.

This is the current implementation:

template <class G>
std::vector<std::vector<int64_t>>
sloan(G &graph) {

    CHECK_FOR_INTERRUPTS();

    std::pair<typename G::V, typename G::V> starting_nodes =
            boost::sloan_starting_nodes(graph.graph);

    std::vector<typename G::V> inv_perm(graph.num_vertices());

    boost::sloan_ordering(
            graph.graph,
            inv_perm.begin(),
            boost::get(boost::vertex_color_t(), graph.graph),
            boost::make_degree_map(graph.graph),
            starting_nodes.first,
            starting_nodes.second
            );

    CHECK_FOR_INTERRUPTS();

    std::vector<int64_t> result;
    result.reserve(inv_perm.size());

    for (const auto& vertex_desc : inv_perm) {
            result.push_back(graph[vertex_desc].id);
    }

    return result;
}  

Here, I have used the correct sloan_starting_nodes algorithm to call the boost function. I have also written the types_check.pg file for my function for initial testing phase and starting next week I hope to start running the docqueries. This week I couldn’t do much since I was travelling and was a little sick anyways, hoping to double the work in the coming days!


<
Previous Post
Official Coding Period: Week 3 (June 16 – June 22)
>
Next Post
Official Coding Period: Week 5 (June 30 - July 6)