From 4ff739d6253d286167d8f1e452d31134c720f0cf Mon Sep 17 00:00:00 2001 From: Medusa Slockbower Date: Mon, 18 Aug 2025 23:13:09 -0400 Subject: [PATCH] - Fixed Doxygen Structure once more, this bug with sections appearing under the first subpage is becoming frustrating. Currently got it so everything appears under "Contents" --- README.md | 2 +- doxy/Doxyfile | 5 +- doxy/Doxyfile.in | 3 +- include/fennec/containers/graph.h | 81 ++++++++++++++++++++++------ include/fennec/containers/map.h | 2 +- include/fennec/containers/multiset.h | 4 ++ include/fennec/containers/set.h | 4 ++ include/fennec/core/engine.h | 23 ++++++++ 8 files changed, 103 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ee2895c..bb2d910 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ sudo dnf install doxygen graphviz script in WSL, simply use the "bash" command in Command Prompt or PowerShell. The script will require the build [dependencies](#dependencies) installed and configured to be available on the `PATH` environment variable. -Fore more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/) for Windows Build 14316. +For more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/) for Windows Build 14316. Otherwise, follow the sequence of commands provided in the bash script. diff --git a/doxy/Doxyfile b/doxy/Doxyfile index ba17054..55e7a24 100644 --- a/doxy/Doxyfile +++ b/doxy/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = fennec # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = 1.0.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -944,7 +944,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = "/home/medusa/Documents/Work/Personal/fennec/include" \ - "/home/medusa/Documents/Work/Personal/fennec/source" + "/home/medusa/Documents/Work/Personal/fennec/source" \ + "/home/medusa/Documents/Work/Personal/fennec/README.md" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/doxy/Doxyfile.in b/doxy/Doxyfile.in index 7e8ae61..b3574c8 100644 --- a/doxy/Doxyfile.in +++ b/doxy/Doxyfile.in @@ -944,7 +944,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = "@PROJECT_SOURCE_DIR@/include" \ - "@PROJECT_SOURCE_DIR@/source" + "@PROJECT_SOURCE_DIR@/source" \ + "@PROJECT_SOURCE_DIR@/README.md" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/include/fennec/containers/graph.h b/include/fennec/containers/graph.h index 98ff5b9..d52ac53 100644 --- a/include/fennec/containers/graph.h +++ b/include/fennec/containers/graph.h @@ -43,6 +43,20 @@ namespace fennec /// \brief Graph Data Structure, describes sets of arbitrarily connected nodes /// /// \details +/// | Property | Value | +/// |:----------:|:----------:| +/// | stable | ⛔ | +/// | dynamic | ✅ | +/// | homogenous | ✅ | +/// | distinct | ⛔ | +/// | ordered | ⛔ | +/// | space | \f$O(N)\f$ | +/// | linear | ✅ | +/// | access | \f$O(1)\f$ | +/// | find | \f$O(1)\f$ | +/// | insertion | \f$O(1)\f$ | +/// | deletion | \f$O(N)\f$ | +/// /// Graphs contain nodes (sometimes called vertices) and connections. Graphs are either directed /// or undirected. This structure allows the creation of both directed and undirected connections. As /// far as what that means; a directed graph means that connections have direction, where there are connections @@ -129,10 +143,12 @@ public: return num_nodes() == 0; } + // TODO: connected, disjoint + /// @} - // Access ============================================================================================================== +// Access ============================================================================================================== /// \name Access /// @{ @@ -157,22 +173,32 @@ public: /// \brief Connection Access Operator /// \param a The id of the first node /// \param b The id of the second node - /// \returns A reference to the value stored in the connection - constexpr weight_t& operator[](size_t a, size_t b) { + /// \returns A pointer to the value stored in the connection, `nullptr` if not found + constexpr weight_t* operator[](size_t a, size_t b) { + if (empty()) { + return nullptr; + } weight_t* it = _conn_map[a][b]; - assertd(it, "Element not Found!"); - return _conn_pool[*it]; + if (it) { + return _conn_pool[*it]; + } + return nullptr; } /// /// \brief Connection Const Access Operator /// \param a The id of the first node /// \param b The id of the second node - /// \returns A const-qualified reference to the value stored in the connection - constexpr const weight_t& operator[](size_t a, size_t b) const { - weight_t* it = _conn_map[a][b]; - assertd(it, "Element not Found!"); - return _conn_pool[*it]; + /// \returns A const-qualified pointer to the value stored in the connection, `nullptr` if not found + constexpr const weight_t* operator[](size_t a, size_t b) const { + if (empty()) { + return nullptr; + } + const weight_t* it = _conn_map[a][b]; + if (it) { + return _conn_pool[*it]; + } + return nullptr; } /// @@ -181,6 +207,9 @@ public: /// \returns A list containing all nodes `x` with connections from `node` to `x...` list outgoing(size_t node) { list res; + if (empty() || node >= _conn_map.size()) { + return res; + } for (const auto& it : _conn_map[node]) { res.push_back(it.first); } @@ -193,7 +222,10 @@ public: /// \returns A list containing all nodes `x` with connections from `x...` to `node` list incoming(size_t node) { list res; - for (int n = 0; n < _conn_map.size(); ++n) { + if (empty() || node >= _conn_map.size()) { + return res; + } + for (size_t n = 0; n < _conn_map.size(); ++n) { if (_conn_map[n][node]) { res.push_back(n); } @@ -202,12 +234,14 @@ public: } /// - /// \brief - /// \param node A list of all nodes `x` that have symmetric connections with `node`, i.e. `node` has a connection - /// both to and from `x...` + /// \brief Getter for a list of nodes `x` that `node` has a connection to and from `x...` + /// \param node The id of the node /// \returns A list containing all nodes `x` that have symmetric connections with `node` list symmetric(size_t node) { list res; + if (empty() || node >= _conn_map.size()) { + return res; + } for (const auto& it : _conn_map[node]) { if (_conn_map[it.first][node]) { res.push_back(it.first); @@ -216,8 +250,23 @@ public: return res; } - - + /// + /// \brief Getter for a list of nodes `x` that `node` has a connection to and from `x...` and share the same weight + /// \param node The id of the node + /// \returns A list containing all nodes `x` that have symmetric connections with `node` + list joined(size_t node) { + list res; + if (empty() || node >= _conn_map.size()) { + return res; + } + for (const auto& it : _conn_map[node]) { + const auto* at = _conn_map[it.first][node]; + if (at == &it.second) { + res.push_back(it.first); + } + } + return res; + } /// @} diff --git a/include/fennec/containers/map.h b/include/fennec/containers/map.h index 1be8f34..96702d2 100644 --- a/include/fennec/containers/map.h +++ b/include/fennec/containers/map.h @@ -258,7 +258,7 @@ private: set_t _set; template - set_t::iterator _find(ArgsT&&...args) { + set_t::iterator _find(ArgsT&&...args) const { union U { // Hacky way of avoiding constructing the value, TODO: Check for warnings on other compilers pair root; pair val; diff --git a/include/fennec/containers/multiset.h b/include/fennec/containers/multiset.h index 310e061..ccc9d49 100644 --- a/include/fennec/containers/multiset.h +++ b/include/fennec/containers/multiset.h @@ -495,6 +495,8 @@ public: /// \name Iteration /// @{ + /// + /// \returns An iterator for all elements of the set in no particular order constexpr iterator begin() const { iterator it(this, 0); if (not _alloc[it._i].value) { @@ -503,6 +505,8 @@ public: return it; } + /// + /// \returns An iterator representing the end of the set constexpr iterator end() const { return iterator(this, npos); } diff --git a/include/fennec/containers/set.h b/include/fennec/containers/set.h index 15b3e55..db26e0f 100644 --- a/include/fennec/containers/set.h +++ b/include/fennec/containers/set.h @@ -441,6 +441,8 @@ public: /// \name Iteration /// @{ + /// + /// \returns An iterator for all elements of the set in no particular order constexpr iterator begin() const { iterator it(this, 0); if (not _alloc[it._i].value) { @@ -449,6 +451,8 @@ public: return it; } + /// + /// \returns An iterator representing the end of the set constexpr iterator end() const { return iterator(this, npos); } diff --git a/include/fennec/core/engine.h b/include/fennec/core/engine.h index 74c0aff..faa4fca 100644 --- a/include/fennec/core/engine.h +++ b/include/fennec/core/engine.h @@ -28,6 +28,29 @@ /// /// +/// +/// \page contents Contents +/// +/// 1. \ref introduction "Introduction" +/// 1. \ref coding-standards "Coding Standards" +/// 2. \ref building-from-source "Building from Source" +/// 1. \ref building-from-terminal "Building from Terminal" +/// 1. \ref debian "Debian" +/// 2. \ref fedora-dnf "Fedora" +/// 2. \ref building-on-windows "Building on Windows" +/// 3. \ref running-the-test-suite "Running the Test Suite" +/// 4. \ref usage "Usage" +/// 1. \ref licensing "Licensing" +/// 5. \ref contribution "Contribution" +/// 6. \subpage libraries +/// 1. \ref fennec_lang "C++ Language Library" +/// 2. \ref fennec_math "Math Library" +/// 2. \ref fennec_memory "Memory Management Library" +/// 2. \ref fennec_containers "Containers Library" +/// +/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)) +/// + /// /// \page libraries Libraries ///