HIBF 1.0.0-rc.1
All Classes Namespaces Files Functions Variables Typedefs Friends Macros Modules Pages Concepts
graph.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <cstddef> // for size_t
13#include <optional> // for nullopt, optional
14#include <vector> // for vector
15
16#include <hibf/layout/layout.hpp> // for layout
17
18namespace seqan::hibf::layout
19{
20
24struct graph
25{
26
30 graph() = default;
31 graph(graph const &) = default;
32 graph & operator=(graph const &) = default;
33 graph(graph &&) = default;
34 graph & operator=(graph &&) = default;
35 ~graph() = default;
36
37 graph(seqan::hibf::layout::layout const & hibf_layout);
39
40 struct node
41 {
42 std::vector<node> children{};
43
44 size_t parent_bin_index{};
45 size_t max_bin_index{};
46 size_t number_of_technical_bins{};
47 std::optional<size_t> favourite_child_idx{std::nullopt};
48 std::vector<layout::layout::user_bin> remaining_records{}; // non-merged bins (either split or single)
49
50 bool max_bin_is_merged() const
51 {
52 return favourite_child_idx.has_value();
53 }
54
55 // Doesn't work, because the type is incomplete. To compare node, a comparison for the children member is needed.
56 // But children is a std::vector<node>, so a comparison for node is needed to compare children.
57 // https://godbolt.org/z/arrr4YKae
58 // friend auto operator<=>(node const &, node const &) = default;
59 };
60
61 node root;
62};
63
64} // namespace seqan::hibf::layout
T is_base_of_v
T has_value(T... args)
Definition graph.hpp:41
Contains the layout graph structure.
Definition graph.hpp:25
graph(seqan::hibf::layout::layout const &hibf_layout)
Defaulted.
graph(graph &&)=default
Defaulted.
~graph()=default
Defaulted.
graph & operator=(graph const &)=default
Defaulted.
graph & operator=(graph &&)=default
Defaulted.
graph(graph const &)=default
Defaulted.
graph()=default
Defaulted.
The layout.
Definition layout.hpp:22