21#ifndef LIBSEMIGROUPS_WORD_GRAPH_HELPERS_HPP_
22#define LIBSEMIGROUPS_WORD_GRAPH_HELPERS_HPP_
25#include <initializer_list>
37#include <unordered_map>
38#include <unordered_set>
42#include "libsemigroups/adapters.hpp"
43#include "libsemigroups/config.hpp"
44#include "libsemigroups/constants.hpp"
45#include "libsemigroups/debug.hpp"
46#include "libsemigroups/dot.hpp"
47#include "libsemigroups/exception.hpp"
48#include "libsemigroups/forest.hpp"
49#include "libsemigroups/order.hpp"
50#include "libsemigroups/types.hpp"
51#include "libsemigroups/word-graph-view.hpp"
52#include "libsemigroups/word-graph.hpp"
54#include "libsemigroups/detail/fmt.hpp"
55#include "libsemigroups/detail/stl.hpp"
56#include "libsemigroups/detail/string.hpp"
57#include "libsemigroups/detail/uf.hpp"
59#ifdef LIBSEMIGROUPS_EIGEN_ENABLED
60#include "detail/eigen.hpp"
80 namespace word_graph {
109 template <
typename Node,
typename Iterator>
110 void add_cycle_no_checks(WordGraph<Node>& wg,
129 template <
typename Node>
130 void add_cycle(WordGraph<Node>& wg,
size_t N) {
131 size_t M = wg.number_of_nodes();
133 add_cycle_no_checks(wg, wg.cbegin_nodes() + M, wg.cend_nodes());
151 template <
typename Node>
152 [[nodiscard]]
auto adjacency_matrix(WordGraphView<Node>
const& wg);
169 template <
typename Node>
170 [[nodiscard]]
auto adjacency_matrix(WordGraph<Node>
const& wg) {
171 return adjacency_matrix(WordGraphView<Node>(wg));
184 template <
typename Node>
185 [[nodiscard]] Dot dot(WordGraphView<Node>
const& wg);
197 template <
typename Node>
198 [[nodiscard]] Dot dot(WordGraph<Node>
const& wg) {
199 return dot(WordGraphView<Node>(wg));
228 template <
typename Node>
229 [[nodiscard]]
bool equal_to_no_checks(WordGraph<Node>
const& x,
230 WordGraph<Node>
const& y,
233 WordGraphView<Node> x_view = WordGraphView<Node>(x, first, last);
234 WordGraphView<Node> y_view = WordGraphView<Node>(y, first, last);
235 return x_view == y_view;
262 template <
typename Node>
263 [[nodiscard]]
bool equal_to(WordGraph<Node>
const& x,
264 WordGraph<Node>
const& y,
300 template <
typename Node1,
typename Node2,
typename Iterator>
301 [[nodiscard]] Node1 follow_path(WordGraphView<Node1>
const& wg,
338 template <
typename Node1,
typename Node2,
typename Iterator>
339 [[nodiscard]] Node1 follow_path(WordGraph<Node1>
const& wg,
343 return follow_path(WordGraphView<Node1>(wg), source, first, last);
375 template <
typename Node1,
typename Node2>
376 [[nodiscard]] Node1 follow_path(WordGraphView<Node1>
const& wg,
379 static_assert(
sizeof(Node2) <=
sizeof(Node1));
380 return follow_path(wg, from, path.cbegin(), path.cend());
412 template <
typename Node1,
typename Node2>
413 [[nodiscard]] Node1 follow_path(WordGraph<Node1>
const& wg,
416 static_assert(
sizeof(Node2) <=
sizeof(Node1));
418 WordGraphView<Node1>(wg), from, path.cbegin(), path.cend());
447 template <
typename Node1,
typename Node2,
typename Iterator>
448 [[nodiscard]] Node1 follow_path_no_checks(WordGraphView<Node1>
const& wg,
451 Iterator last)
noexcept;
479 template <
typename Node1,
typename Node2,
typename Iterator>
480 [[nodiscard]] Node1 follow_path_no_checks(WordGraph<Node1>
const& wg,
483 Iterator last)
noexcept {
484 return follow_path_no_checks(
485 WordGraphView<Node1>(wg), from, first, last);
514 template <
typename Node1,
typename Node2>
516 follow_path_no_checks(WordGraphView<Node1>
const& wg,
519 static_assert(
sizeof(Node2) <=
sizeof(Node1));
520 return follow_path_no_checks(wg, from, path.cbegin(), path.cend());
549 template <
typename Node1,
typename Node2>
551 follow_path_no_checks(WordGraph<Node1>
const& wg,
554 static_assert(
sizeof(Node2) <=
sizeof(Node1));
555 return follow_path_no_checks(
556 WordGraphView<Node1>(wg), from, path.cbegin(), path.cend());
593 template <
typename Node>
594 [[nodiscard]]
bool is_acyclic(WordGraphView<Node>
const& wg);
629 template <
typename Node>
630 [[nodiscard]]
bool is_acyclic(WordGraph<Node>
const& wg) {
631 return is_acyclic(WordGraphView<Node>(wg));
680 template <
typename Node1,
typename Node2>
681 [[nodiscard]]
bool is_acyclic(WordGraphView<Node1>
const& wg,
729 template <
typename Node1,
typename Node2>
730 [[nodiscard]]
bool is_acyclic(WordGraph<Node1>
const& wg, Node2 source) {
731 return is_acyclic(WordGraphView<Node1>(wg), source);
765 template <
typename Node1,
typename Node2>
766 [[nodiscard]]
bool is_acyclic(WordGraphView<Node1>
const& wg,
800 template <
typename Node1,
typename Node2>
801 [[nodiscard]]
bool is_acyclic(WordGraph<Node1>
const& wg,
804 return is_acyclic(WordGraphView<Node1>(wg), source, target);
850 template <
typename Node,
854 [[nodiscard]]
bool is_compatible_no_checks(WordGraphView<Node>
const& wg,
855 Iterator1 first_node,
857 Iterator3 first_rule,
858 Iterator3 last_rule);
899 template <
typename Node,
903 [[nodiscard]]
bool is_compatible_no_checks(WordGraph<Node>
const& wg,
904 Iterator1 first_node,
906 Iterator3 first_rule,
907 Iterator3 last_rule) {
908 return is_compatible_no_checks(WordGraphView<Node>(wg),
956 template <
typename Node,
960 typename = std::enable_if_t<
961 !std::is_same_v<std::decay_t<Iterator3>,
word_type>>>
962 [[nodiscard]]
bool is_compatible(WordGraphView<Node>
const& wg,
963 Iterator1 first_node,
965 Iterator3 first_rule,
966 Iterator3 last_rule);
1011 template <
typename Node,
1015 typename = std::enable_if_t<
1016 !std::is_same_v<std::decay_t<Iterator3>,
word_type>>>
1017 [[nodiscard]]
bool is_compatible(WordGraph<Node>
const& wg,
1018 Iterator1 first_node,
1019 Iterator2 last_node,
1020 Iterator3 first_rule,
1021 Iterator3 last_rule) {
1022 WordGraphView<Node> wgv(wg);
1023 return is_compatible(wgv, first_node, last_node, first_rule, last_rule);
1058 template <
typename Node,
typename Iterator1,
typename Iterator2>
1059 bool is_compatible_no_checks(WordGraphView<Node>
const& wg,
1060 Iterator1 first_node,
1061 Iterator2 last_node,
1096 template <
typename Node,
typename Iterator1,
typename Iterator2>
1097 bool is_compatible_no_checks(WordGraph<Node>
const& wg,
1098 Iterator1 first_node,
1099 Iterator2 last_node,
1102 return is_compatible_no_checks(
1103 WordGraphView<Node>(wg), first_node, last_node, lhs, rhs);
1144 template <
typename Node,
typename Iterator1,
typename Iterator2>
1145 bool is_compatible(WordGraphView<Node>
const& wg,
1146 Iterator1 first_node,
1147 Iterator2 last_node,
1188 template <
typename Node,
typename Iterator1,
typename Iterator2>
1189 bool is_compatible(WordGraph<Node>
const& wg,
1190 Iterator1 first_node,
1191 Iterator2 last_node,
1194 return is_compatible(
1195 WordGraphView<Node>(wg), first_node, last_node, lhs, rhs);
1242 TODO(0): Remove or delete
1243 template <typename WordGraphType,
1247 typename = std::enable_if_t<
1248 std::is_same_v<WordGraphType,
1250 WordGraphType::node_type>>
1253 WordGraphView<typename WordGraphType::node_type>>>>
1254 bool is_compatible(WordGraphType const& wg,
1255 Iterator1 first_node,
1256 Iterator2 last_node,
1257 Iterator3 first_rule,
1258 Iterator3 last_rule) {
1259 if constexpr (std::is_same_v<
1261 WordGraph<typename WordGraphType::node_type>>) {
1262 return is_compatible(
1263 static_cast<WordGraph<typename WordGraphType::node_type>
1271 return is_compatible(
1273 WordGraphView<typename WordGraphType::node_type>
1315 template <
typename Node,
typename Iterator1,
typename Iterator2>
1316 [[nodiscard]]
bool is_complete_no_checks(WordGraphView<Node>
const& wg,
1317 Iterator1 first_node,
1318 Iterator2 last_node);
1351 template <
typename Node,
typename Iterator1,
typename Iterator2>
1352 [[nodiscard]]
bool is_complete_no_checks(WordGraph<Node>
const& wg,
1353 Iterator1 first_node,
1354 Iterator2 last_node) {
1355 return is_complete_no_checks(
1356 WordGraphView<Node>(wg), first_node, last_node);
1388 template <
typename Node,
typename Iterator1,
typename Iterator2>
1389 [[nodiscard]]
bool is_complete(WordGraphView<Node>
const& wg,
1390 Iterator1 first_node,
1391 Iterator2 last_node);
1422 template <
typename Node,
typename Iterator1,
typename Iterator2>
1423 [[nodiscard]]
bool is_complete(WordGraph<Node>
const& wg,
1424 Iterator1 first_node,
1425 Iterator2 last_node) {
1426 return is_complete(WordGraphView<Node>(wg), first_node, last_node);
1447 template <
typename Node>
1449 is_complete_no_checks(WordGraphView<Node>
const& wg)
noexcept {
1450 return wg.number_of_edges_no_checks()
1451 == wg.number_of_nodes_no_checks() * wg.out_degree_no_checks();
1454 template <
typename Node>
1455 [[nodiscard]]
bool is_complete(WordGraphView<Node>
const& wg) {
1456 wg.throw_if_invalid_view();
1457 return is_complete_no_checks(wg);
1478 template <
typename Node>
1479 [[nodiscard]]
bool is_complete(WordGraph<Node>
const& wg)
noexcept {
1480 return is_complete(WordGraphView<Node>(wg));
1507 template <
typename Node>
1508 [[nodiscard]]
bool is_connected(WordGraphView<Node>
const& wg);
1533 template <
typename Node>
1534 [[nodiscard]]
bool is_connected(WordGraph<Node>
const& wg) {
1535 return is_connected(WordGraphView<Node>(wg));
1588 template <
typename Node1,
typename Node2>
1589 [[nodiscard]]
bool is_reachable_no_checks(WordGraphView<Node1>
const& wg,
1642 template <
typename Node1,
typename Node2>
1643 [[nodiscard]]
bool is_reachable_no_checks(WordGraph<Node1>
const& wg,
1646 return is_reachable_no_checks(WordGraphView<Node1>(wg), source, target);
1681 template <
typename Node1,
typename Node2>
1682 [[nodiscard]]
bool is_reachable(WordGraphView<Node1>
const& wg,
1718 template <
typename Node1,
typename Node2>
1719 [[nodiscard]]
bool is_reachable(WordGraph<Node1>
const& wg,
1722 return is_reachable(WordGraphView<Node1>(wg), source, target);
1759 template <
typename Node>
1760 [[nodiscard]]
bool is_strictly_cyclic(WordGraphView<Node>
const& wg);
1796 template <
typename Node>
1797 [[nodiscard]]
bool is_strictly_cyclic(WordGraph<Node>
const& wg) {
1798 return is_strictly_cyclic(WordGraphView<Node>(wg));
1827 template <
typename Node1,
typename Node2,
typename Iterator>
1828 [[nodiscard]] std::pair<Node1, Iterator>
1829 last_node_on_path_no_checks(WordGraphView<Node1>
const& wg,
1832 Iterator last)
noexcept;
1860 template <
typename Node1,
typename Node2,
typename Iterator>
1861 [[nodiscard]] std::pair<Node1, Iterator>
1862 last_node_on_path_no_checks(WordGraph<Node1>
const& wg,
1865 Iterator last)
noexcept {
1866 return last_node_on_path_no_checks(
1867 WordGraphView<Node1>(wg), source, first, last);
1895 template <
typename Node1,
typename Node2,
typename Iterator>
1896 [[nodiscard]] std::pair<Node1, Iterator>
1897 last_node_on_path(WordGraphView<Node1>
const& wg,
1927 template <
typename Node1,
typename Node2,
typename Iterator>
1928 [[nodiscard]] std::pair<Node1, Iterator>
1929 last_node_on_path(WordGraph<Node1>
const& wg,
1933 return last_node_on_path(WordGraphView<Node1>(wg), source, first, last);
1957 template <
typename Node1,
typename Node2>
1958 std::pair<Node1, word_type::const_iterator>
1959 last_node_on_path_no_checks(WordGraphView<Node1>
const& wg,
1984 template <
typename Node1,
typename Node2>
1985 std::pair<Node1, word_type::const_iterator>
1986 last_node_on_path_no_checks(WordGraph<Node1>
const& wg,
1989 return last_node_on_path_no_checks(WordGraphView<Node1>(wg), source, w);
2013 template <
typename Node1,
typename Node2>
2014 std::pair<Node1, word_type::const_iterator>
2015 last_node_on_path(WordGraphView<Node1>
const& wg,
2040 template <
typename Node1,
typename Node2>
2041 std::pair<Node1, word_type::const_iterator>
2042 last_node_on_path(WordGraph<Node1>
const& wg,
2045 return last_node_on_path(WordGraphView<Node1>(wg), source, w);
2075 template <
typename Node1,
typename Node2>
2076 [[nodiscard]] std::unordered_set<Node1>
2077 nodes_reachable_from(WordGraphView<Node1>
const& wg, Node2 source);
2106 template <
typename Node1,
typename Node2>
2107 [[nodiscard]] std::unordered_set<Node1>
2108 nodes_reachable_from(WordGraph<Node1>
const& wg, Node2 source) {
2109 return nodes_reachable_from(WordGraphView<Node1>(wg), source);
2132 template <
typename Node1,
typename Node2>
2133 [[nodiscard]] std::unordered_set<Node1>
2134 ancestors_of(WordGraphView<Node1>
const& wg, Node2 target);
2156 template <
typename Node1,
typename Node2>
2157 [[nodiscard]] std::unordered_set<Node1>
2158 ancestors_of(WordGraph<Node1>
const& wg, Node2 target) {
2159 return ancestors_of(WordGraphView<Node1>(wg), target);
2183 template <
typename Node1,
typename Node2>
2184 [[nodiscard]] std::unordered_set<Node1>
2185 nodes_reachable_from_no_checks(WordGraph<Node1>
const& wg, Node2 source);
2208 template <
typename Node1,
typename Node2>
2209 [[nodiscard]] std::unordered_set<Node1>
2210 ancestors_of_no_checks(WordGraphView<Node1>
const& wg, Node2 target);
2233 template <
typename Node1,
typename Node2>
2234 [[nodiscard]] std::unordered_set<Node1>
2235 ancestors_of_no_checks(WordGraph<Node1>
const& wg, Node2 target) {
2236 return ancestors_of_no_checks(WordGraphView<Node1>(wg), target);
2259 template <
typename Node1,
typename Node2>
2260 [[nodiscard]]
size_t
2261 number_of_nodes_reachable_from(WordGraphView<Node1>
const& wg,
2263 return nodes_reachable_from(wg, source).size();
2286 template <
typename Node1,
typename Node2>
2287 [[nodiscard]]
size_t
2288 number_of_nodes_reachable_from(WordGraph<Node1>
const& wg, Node2 source) {
2289 return number_of_nodes_reachable_from(WordGraphView<Node1>(wg), source);
2310 template <
typename Node1,
typename Node2>
2311 [[nodiscard]]
size_t
2312 number_of_nodes_reachable_from_no_checks(WordGraphView<Node1>
const& wg,
2314 return nodes_reachable_from_no_checks(wg, source).size();
2335 template <
typename Node1,
typename Node2>
2336 [[nodiscard]]
size_t
2337 number_of_nodes_reachable_from_no_checks(WordGraph<Node1>
const& wg,
2339 return number_of_nodes_reachable_from_no_checks(
2340 WordGraphView<Node1>(wg), source);
2364 template <
typename Node>
2365 WordGraph<Node> random_acyclic(
size_t number_of_nodes,
2368 = std::mt19937(std::random_device()()));
2389 template <
typename Node1,
typename Node2>
2390 void spanning_tree_no_checks(WordGraphView<Node1>
const& wg,
2413 template <
typename Node1,
typename Node2>
2414 void spanning_tree_no_checks(WordGraph<Node1>
const& wg,
2417 return spanning_tree_no_checks(WordGraphView<Node1>(wg), root, f);
2438 template <
typename Node1,
typename Node2>
2439 void spanning_tree(WordGraphView<Node1>
const& wg, Node2 root, Forest& f);
2459 template <
typename Node1,
typename Node2>
2460 void spanning_tree(WordGraph<Node1>
const& wg, Node2 root, Forest& f) {
2461 spanning_tree(WordGraphView<Node1>(wg), root, f);
2484 template <
typename Node1,
typename Node2>
2485 [[nodiscard]] Forest
2486 spanning_tree_no_checks(WordGraphView<Node1>
const& wg, Node2 root);
2508 template <
typename Node1,
typename Node2>
2509 [[nodiscard]] Forest spanning_tree_no_checks(WordGraph<Node1>
const& wg,
2511 return spanning_tree_no_checks(WordGraphView<Node1>(wg), root);
2533 template <
typename Node1,
typename Node2>
2534 [[nodiscard]] Forest spanning_tree(WordGraphView<Node1>
const& wg,
2556 template <
typename Node1,
typename Node2>
2557 [[nodiscard]] Forest spanning_tree(WordGraph<Node1>
const& wg,
2559 return spanning_tree(WordGraphView<Node1>(wg), root);
2586 template <
typename Graph>
2587 bool standardize(Graph& wg, Forest& f,
Order val);
2614 template <
typename Graph>
2615 std::pair<bool, Forest> standardize(Graph& wg,
2634 template <
typename Node>
2635 bool is_standardized(WordGraphView<Node>
const& wg,
2654 template <
typename Node>
2655 bool is_standardized(WordGraph<Node>
const& wg,
2657 return is_standardized(WordGraphView<Node>(wg), val);
2683 template <
typename Node>
2684 [[nodiscard]] std::vector<Node>
2685 topological_sort(WordGraphView<Node>
const& wg);
2710 template <
typename Node>
2711 [[nodiscard]] std::vector<Node>
2712 topological_sort(WordGraph<Node>
const& wg) {
2713 return topological_sort(WordGraphView<Node>(wg));
2742 template <
typename Node1,
typename Node2>
2743 [[nodiscard]] std::vector<Node1>
2744 topological_sort(WordGraphView<Node1>
const& wg, Node2 source);
2772 template <
typename Node1,
typename Node2>
2773 [[nodiscard]] std::vector<Node1>
2774 topological_sort(WordGraph<Node1>
const& wg, Node2 source) {
2775 return topological_sort(WordGraphView<Node1>(wg), source);
2804 template <
typename Node>
2848 template <
typename Return>
2849 [[nodiscard]] std::enable_if_t<is_specialization_of_v<Return, WordGraph>,
2861 template <
typename Return>
2862 [[nodiscard]] std::enable_if_t<is_specialization_of_v<Return, WordGraph>,
2868 template <
typename Sub
class>
2869 class JoinerMeeterCommon {
2871 template <
typename Node1,
typename Node2>
2878 template <
typename Node>
2885 template <
typename Node>
2889 return call_no_checks(
2890 xy, x,
static_cast<Node
>(0), y,
static_cast<Node
>(0));
2893 template <
typename Node,
typename... Args>
2901 static_cast<Subclass&
>(*this).call_no_checks(
2910 template <
typename Node>
2911 void operator()(WordGraph<Node>& xy,
2912 WordGraph<Node>
const& x,
2914 WordGraph<Node>
const& y,
2916 throw_if_bad_args(x, xroot, y, yroot);
2917 call_no_checks(xy, x, xroot, y, yroot);
2920 template <
typename Node>
2921 void operator()(WordGraph<Node>& xy,
2922 WordGraph<Node>
const& x,
2923 WordGraph<Node>
const& y) {
2925 xy, x,
static_cast<Node
>(0), y,
static_cast<Node
>(0));
2928 template <
typename Node,
typename... Args>
2929 [[nodiscard]]
auto operator()(WordGraph<Node>
const& x, Args&&... args)
2930 -> std::enable_if_t<
sizeof...(Args) % 2 == 1, WordGraph<Node>> {
2939 template <
typename Node1,
typename Node2>
2940 bool is_subrelation_no_checks(WordGraph<Node1>
const& x,
2942 WordGraph<Node1>
const& y,
2945 template <
typename Node>
2946 bool is_subrelation_no_checks(WordGraph<Node>
const& x,
2947 WordGraph<Node>
const& y) {
2948 return is_subrelation_no_checks(
2949 x,
static_cast<Node
>(0), y,
static_cast<Node
>(0));
2956 template <
typename Node1,
typename Node2>
2957 bool is_subrelation(WordGraph<Node1>
const& x,
2959 WordGraph<Node1>
const& y,
2961 throw_if_bad_args(x, xroot, y, yroot);
2962 return is_subrelation_no_checks(x, xroot, y, yroot);
2965 template <
typename Node>
2966 bool is_subrelation(WordGraph<Node>
const& x,
2967 WordGraph<Node>
const& y) {
2968 return is_subrelation(
2969 x,
static_cast<Node
>(0), y,
static_cast<Node
>(0));
2989 class Joiner :
public detail::JoinerMeeterCommon<Joiner> {
2992 libsemigroups::detail::Duf<> _uf;
2996 template <
typename Node>
2998 size_t xnum_nodes_reachable_from_root,
3003 template <
typename Node>
3005 size_t xnum_nodes_reachable_from_root,
3008 size_t ynum_nodes_reachable_from_root,
3067 template <
typename Node>
3070 size_t xnum_nodes_reachable_from_root,
3073 size_t ynum_nodes_reachable_from_root,
3110 template <
typename Node1,
typename Node2>
3113 size_t xnum_nodes_reachable_from_root,
3116 size_t ynum_nodes_reachable_from_root,
3118#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
3142 template <
typename Node>
3168 template <
typename Node>
3192 template <
typename Node,
typename... Args>
3221 template <
typename Node>
3249 template <
typename Node>
3271 template <
typename Node,
typename... Args>
3304 template <
typename Node1,
typename Node2>
3332 template <
typename Node>
3368 template <
typename Node1,
typename Node2>
3398 template <
typename Node>
3403 using detail::JoinerMeeterCommon<
Joiner>::operator();
3422 class Meeter :
public detail::JoinerMeeterCommon<Meeter> {
3460 template <
typename Node>
3463 size_t xnum_nodes_reachable_from_root,
3466 size_t ynum_nodes_reachable_from_root,
3472 template <
typename Node1,
typename Node2>
3475 size_t xnum_nodes_reachable_from_root,
3478 size_t ynum_nodes_reachable_from_root,
3481#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
3484 template <
typename Node>
3493 template <
typename Node>
3517 template <
typename Node,
typename... Args>
3523 template <
typename Node>
3532 template <
typename Node>
3554 template <
typename Node,
typename... Args>
3559 template <
typename Node1,
typename Node2>
3567 template <
typename Node>
3573 template <
typename Node1,
typename Node2>
3581 template <
typename Node>
3585 using detail::JoinerMeeterCommon<
Meeter>::operator();
3605 template <
typename Node>
3623 return "<Meeter of word graphs>";
3641 return "<Joiner of word graphs>";
3664 template <
typename Node>
3673#include "libsemigroups/word-graph-helpers.tpp"
Class for representing word graphs.
Definition word-graph.hpp:83
Node label_type
The type of edge labels in a word graph.
Definition word-graph.hpp:102
Class for taking joins of word graphs.
Definition word-graph-helpers.hpp:2989
bool is_subrelation_no_checks(WordGraph< Node > const &x, WordGraph< Node > const &y)
Check if the language accepted by one word graph is contained in that defined by another word graph.
auto call_no_checks(WordGraph< Node > const &x, Args &&... args)
Returns a word graph containing the join/meet of two given word graphs.
auto operator()(WordGraph< Node > const &x, Args &&... args)
Returns a word graph containing the join/meet of two given word graphs.
Joiner(Joiner const &)
Default copy constructor.
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, Node xroot, WordGraph< Node > const &y, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
bool is_subrelation(WordGraph< Node1 > const &x, Node2 xroot, WordGraph< Node1 > const &y, Node2 yroot)
Check if the language accepted by one word graph is contained in that defined by another word graph.
Joiner(Joiner &&)
Default move constructor.
bool is_subrelation_no_checks(WordGraph< Node1 > const &x, Node2 xroot, WordGraph< Node1 > const &y, Node2 yroot)
Check if the language accepted by one word graph is contained in that defined by another word graph.
Joiner()
Default constructor.
Joiner & operator=(Joiner const &)
Default copy assignment operator.
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, WordGraph< Node > const &y)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
Joiner & operator=(Joiner &&)
Default move assignment operator.
bool is_subrelation(WordGraph< Node > const &x, WordGraph< Node > const &y)
Check if the language accepted by one word graph is contained in that defined by another word graph.
void operator()(WordGraph< Node > &xy, WordGraph< Node > const &x, WordGraph< Node > const &y)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, size_t xnum_nodes_reachable_from_root, Node xroot, WordGraph< Node > const &y, size_t ynum_nodes_reachable_from_root, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
bool is_subrelation_no_checks(WordGraph< Node1 > const &x, size_t xnum_nodes_reachable_from_root, Node2 xroot, WordGraph< Node1 > const &y, size_t ynum_nodes_reachable_from_root, Node2 yroot)
Check if the language accepted by one word graph is contained in that accepted by another word graph.
void operator()(WordGraph< Node > &xy, WordGraph< Node > const &x, Node xroot, WordGraph< Node > const &y, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
Class for taking meets of word graphs.
Definition word-graph-helpers.hpp:3422
bool is_subrelation_no_checks(WordGraph< Node > const &x, WordGraph< Node > const &y)
Check if the language accepted by one word graph is contained in that defined by another word graph.
auto call_no_checks(WordGraph< Node > const &x, Args &&... args)
Returns a word graph containing the join/meet of two given word graphs.
auto operator()(WordGraph< Node > const &x, Args &&... args)
Returns a word graph containing the join/meet of two given word graphs.
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, Node xroot, WordGraph< Node > const &y, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
bool is_subrelation(WordGraph< Node1 > const &x, Node2 xroot, WordGraph< Node1 > const &y, Node2 yroot)
Check if the language accepted by one word graph is contained in that defined by another word graph.
bool is_subrelation_no_checks(WordGraph< Node1 > const &x, Node2 xroot, WordGraph< Node1 > const &y, Node2 yroot)
Check if the language accepted by one word graph is contained in that defined by another word graph.
Meeter & operator=(Meeter const &)
Default copy assignment operator.
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, WordGraph< Node > const &y)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
Meeter()
Default constructor.
Meeter & operator=(Meeter &&)
Default move assignment operator.
bool is_subrelation(WordGraph< Node > const &x, WordGraph< Node > const &y)
Check if the language accepted by one word graph is contained in that defined by another word graph.
void operator()(WordGraph< Node > &xy, WordGraph< Node > const &x, WordGraph< Node > const &y)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
Meeter(Meeter &&)
Default move constructor.
void call_no_checks(WordGraph< Node > &xy, WordGraph< Node > const &x, size_t xnum_nodes_reachable_from_root, Node xroot, WordGraph< Node > const &y, size_t ynum_nodes_reachable_from_root, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
Meeter(Meeter const &)
Default copy constructor.
bool is_subrelation_no_checks(WordGraph< Node1 > const &x, size_t xnum_nodes_reachable_from_root, Node2 xroot, WordGraph< Node1 > const &y, size_t ynum_nodes_reachable_from_root, Node2 yroot)
Check if the language accepted by one word graph is contained in that accepted by another word graph.
void operator()(WordGraph< Node > &xy, WordGraph< Node > const &x, Node xroot, WordGraph< Node > const &y, Node yroot)
Replace the contents of a word graph with the join/meet of two given word graphs with respect to give...
std::enable_if_t< is_specialization_of_v< Return, WordGraph >, Return > make(size_t num_nodes, std::initializer_list< std::vector< typename Return::node_type > > targets)
Constructs a word graph from a number of nodes and targets.
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition types.hpp:99
Order
The possible orderings of words and strings.
Definition order.hpp:54
@ shortlex
Definition order.hpp:60
std::ostream & operator<<(std::ostream &os, WordGraph< Node > const &wg)
std::string to_human_readable_repr(WordGraph< Node > const &wg)
Return a human readable representation of a WordGraph object.
std::string to_input_string(WordGraph< Node > const &wg, std::string const &prefix="", std::string const &braces="{}", std::string const &suffix="")
Return a string that can be used to recreate a word graph.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44