Skip to content

Initial CPP-SGL Draft - #113

Open
SpectraL519 wants to merge 1 commit into
cpp-sgl-devfrom
cpp-sgl-draft
Open

Initial CPP-SGL Draft#113
SpectraL519 wants to merge 1 commit into
cpp-sgl-devfrom
cpp-sgl-draft

Conversation

@SpectraL519

Copy link
Copy Markdown
Owner

No description provided.

Comment thread sketch-graph-library.md

@SpectraL519 SpectraL519 Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This file should be removed before delivering the fully prepared/implemented module

For now move this file and the edge-scetch.pdf file to docs/sgl

Comment thread include/sgl/sgl.hpp

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

In general the library avoids such umrella headers for the entire module's content.
In GL and HGL there are the main graph.hpp and hypergraph.hpp file which include all the necessary stuff to operate on a graph and if a user wants to use the elements that are not essential (algorithms, topology generators, file io, etc.), they should include them separately

Comment thread include/sgl/traits.hpp

namespace traits {

inline constexpr std::size_t min_hash_word_size = 8uz;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Is that platform-independent?
Maybe this should be something like sizeof(std::size_t) ???

Comment thread include/sgl/traits.hpp
#include <concepts>
#include <cstddef>

namespace sgl {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Can be collapsed to sgl::traits

Comment thread include/sgl/traits.hpp
using gl::traits::is_instantiation_of_v;

template <typename T>
concept c_weight_type = c_arithmetic<T> and std::floating_point<T>;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

std::floating_point is a more strict requirement than c_arithmetic (which is higly general)

so either you want to restrict the weight types to only floating point types or you want to allow it to be an arbitrary arithmetic type (floating point, integral or custom) - but choose one

then if you have only one requirement there is no need to add a dedicated concept (unless you want to make it explicit for readability) (same for c_uniform_type)

Comment thread include/sgl/registry.hpp
return this->_inv_ids.at(idx);
}

[[nodiscard]] view_type view_at(const size_type idx) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Try using the C++23 explicit object parameter to avoid having two versions of the same method only to satisfy the const/non-const semantics

[[nodiscard]] <conditional-type-or-auto> view_at(this auto& Self, const size_type idx) {
    self._verify_idx(idx);
    // ...
}

The same should be done for other const/non-const methods

Comment thread include/sgl/update.hpp
};

template <traits::c_sketch_traits Traits, typename Key>
void update_es(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

update_edge_scetch - do not abbreviate like that

Comment thread include/sgl/update.hpp
#include <stdexcept>
#include <vector>

namespace sgl {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

  1. Could be collapsed to sgl::detail
  2. If this entire file is in the detail namespace, it should be placed in a detail directory (and probably renamed to update_edge_scetch or edge_scetch_util or something)

Comment thread include/sgl/sketch.hpp
return this->_registry.vertex_ids();
}

[[nodiscard]] gl_attr_force_inline view_type sketch_of(const id_type id) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

As in registry.hpp - should use explicit object parameter
Same for the registry method

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

There should be more tests (for the remaining functionality, not only the scetch type)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants