@@ -1422,6 +1422,7 @@ settings are ignored.
14221422 too few nodes are killed.
14231423:type stop_early: bool
14241424)pbdoc" );
1425+
14251426 thing.def (" shrink_to_fit" ,
14261427 &ToddCoxeterImpl_::shrink_to_fit,
14271428 R"pbdoc(
@@ -1432,6 +1433,7 @@ triggers a full enumeration, and standardization, and removes from
14321433:any:`word_graph` any dead nodes. If :any:`Runner.finished` returns ``False``,
14331434then this function does nothing.
14341435)pbdoc" );
1436+
14351437 thing.def (" standardize" ,
14361438 &ToddCoxeterImpl_::standardize,
14371439 py::arg (" val" ),
@@ -1457,6 +1459,160 @@ calling this function.
14571459:rtype: bool
14581460
14591461.. seealso:: :any:`word_graph.standardize` and :any:`current_spanning_tree`.
1462+ )pbdoc" );
1463+
1464+ thing.def (
1465+ " complete" ,
1466+ [](ToddCoxeterImpl_ const & self) { return self.complete (); },
1467+ R"pbdoc(
1468+ :sig=(self: ToddCoxeter) -> float:
1469+
1470+ Returns the proportion of edges defined in the active part of the current word
1471+ graph.
1472+
1473+ This function returns the proportion (as a float) of the edges defined. This
1474+ value is :any:`number_of_edges_active` divided by :any:`number_of_nodes_active`
1475+ multiplied by :any:`WordGraph.out_degree` applied to :any:`current_word_graph`.
1476+
1477+ :returns:
1478+ The proportion of edges defined in the active part of
1479+ :any:`current_word_graph`.
1480+ :rtype: float
1481+
1482+ .. doctest:: Python
1483+
1484+ >>> from libsemigroups_pybind11 import (Presentation, presentation, ToddCoxeter,
1485+ ... congruence_kind)
1486+ >>> from datetime import timedelta
1487+ >>> p = Presentation("bcd")
1488+ >>> p.contains_empty_word(True)
1489+ <monoid presentation with 3 letters, 0 rules, and length 0>
1490+ >>> presentation.add_rule(p, "bb", "")
1491+ >>> presentation.add_rule(p, "cd", "")
1492+ >>> presentation.add_rule(p, "ccc", "")
1493+ >>> presentation.add_rule(p, "bcbcbcbcbcbcbc", "")
1494+ >>> presentation.add_rule(p, "bcbdbcbdbcbdbc", "")
1495+ >>> tc = ToddCoxeter(congruence_kind.twosided, p)
1496+ >>> tc.run()
1497+ >>> tc.complete()
1498+ 1.0
1499+ )pbdoc" );
1500+
1501+ thing.def (" number_of_edges_active" ,
1502+ &ToddCoxeterImpl_::number_of_edges_active,
1503+ R"pbdoc(
1504+ :sig=(self: ToddCoxeter) -> int:
1505+
1506+ Return the number of edges in the active part of the current word graph.
1507+
1508+ This function returns the number of edges in the active part of the
1509+ :any:`current_word_graph`. Recall that :any:`current_word_graph` can grow and
1510+ shrink drastically during a congruence enumeration. As such to avoid
1511+ unnecessary memory allocations, where possible, the nodes in the
1512+ :any:`current_word_graph` are "recycled" leading to the situation where some of
1513+ the nodes in :any:`current_word_graph` are "active" and others are "inactive".
1514+ In other words, the "active" nodes correspond to the part of the word graph
1515+ that actually represents the classes of the congruence we are trying to
1516+ enumerate; and the "inactive" nodes are only there to be "recycled" into
1517+ "active" nodes if they are required later on.
1518+
1519+ :returns: The number of edges that are incident to active nodes.
1520+ :rtype: int
1521+
1522+ .. doctest:: Python
1523+
1524+ >>> from libsemigroups_pybind11 import (Presentation, presentation, ToddCoxeter,
1525+ ... congruence_kind)
1526+ >>> from datetime import timedelta
1527+ >>> p = Presentation("bcd")
1528+ >>> p.contains_empty_word(True)
1529+ <monoid presentation with 3 letters, 0 rules, and length 0>
1530+ >>> presentation.add_rule(p, "bb", "")
1531+ >>> presentation.add_rule(p, "cd", "")
1532+ >>> presentation.add_rule(p, "ccc", "")
1533+ >>> presentation.add_rule(p, "bcbcbc", "")
1534+ >>> presentation.add_rule(p, "bcbdbcbd", "")
1535+ >>> tc = ToddCoxeter(congruence_kind.twosided, p)
1536+ >>> tc.number_of_classes()
1537+ 12
1538+ >>> tc.number_of_edges_active()
1539+ 36
1540+ )pbdoc" );
1541+
1542+ thing.def (" number_of_nodes_active" ,
1543+ &ToddCoxeterImpl_::number_of_nodes_active,
1544+ R"pbdoc(
1545+ :sig=(self: ToddCoxeter) -> int:
1546+
1547+ Return the number of nodes in the active part of the current word graph.
1548+
1549+ This function returns the number of nodes in the active part of the
1550+ :any:`current_word_graph`. Recall that :any:`current_word_graph` can grow and
1551+ shrink drastically during a congruence enumeration. As such to avoid
1552+ unnecessary memory allocations, where possible, the nodes in the
1553+ :any:`current_word_graph` are "recycled" leading to the situation where some of
1554+ the nodes in :any:`current_word_graph` are "active" and others are "inactive".
1555+ In other words, the "active" nodes correspond to the part of the word graph
1556+ that actually represents the classes of the congruence we are trying to
1557+ enumerate; and the "inactive" nodes are only there to be "recycled" into
1558+ "active" nodes if they are required later on.
1559+
1560+ :returns: The number of nodes that are active.
1561+ :rtype: int
1562+
1563+ .. doctest:: Python
1564+
1565+ >>> from libsemigroups_pybind11 import (Presentation, presentation, ToddCoxeter,
1566+ ... congruence_kind)
1567+ >>> from datetime import timedelta
1568+ >>> p = Presentation("bcd")
1569+ >>> p.contains_empty_word(True)
1570+ <monoid presentation with 3 letters, 0 rules, and length 0>
1571+ >>> presentation.add_rule(p, "bb", "")
1572+ >>> presentation.add_rule(p, "cd", "")
1573+ >>> presentation.add_rule(p, "ccc", "")
1574+ >>> presentation.add_rule(p, "bcbcbc", "")
1575+ >>> presentation.add_rule(p, "bcbdbcbd", "")
1576+ >>> tc = ToddCoxeter(congruence_kind.twosided, p)
1577+ >>> tc.number_of_classes()
1578+ 12
1579+ >>> tc.number_of_nodes_active()
1580+ 12
1581+ )pbdoc" );
1582+
1583+ thing.def (" number_of_large_collapses" ,
1584+ &ToddCoxeterImpl_::number_of_large_collapses,
1585+ R"pbdoc(
1586+ :sig=(self: ToddCoxeter) -> int:
1587+
1588+ Return the number of large collapses that have occurred.
1589+
1590+ This function returns the number of "large" collapses that have occurred in the
1591+ graph during any run of a :any:`ToddCoxeter` instance. What qualifies as a "large"
1592+ collapse can be specified using :any:`large_collapse`.
1593+
1594+ :returns: The number of large collapses.
1595+ :rtype: int
1596+
1597+ .. doctest:: Python
1598+
1599+ >>> from libsemigroups_pybind11 import (Presentation, presentation, ToddCoxeter,
1600+ ... congruence_kind)
1601+ >>> from datetime import timedelta
1602+ >>> p = Presentation("bcd")
1603+ >>> p.contains_empty_word(True)
1604+ <monoid presentation with 3 letters, 0 rules, and length 0>
1605+ >>> presentation.add_rule(p, "bb", "")
1606+ >>> presentation.add_rule(p, "cd", "")
1607+ >>> presentation.add_rule(p, "ccc", "")
1608+ >>> presentation.add_rule(p, "bcbcbcbcbcbcbc", "")
1609+ >>> presentation.add_rule(p, "bcbdbcbdbcbdbcbdbcbdbcbdbcbdbcbd", "")
1610+ >>> tc = ToddCoxeter(congruence_kind.twosided, p)
1611+ >>> tc.run_for(timedelta(milliseconds=10))
1612+ >>> tc.finished()
1613+ False
1614+ >>> tc.number_of_large_collapses()
1615+ 0
14601616)pbdoc" );
14611617 } // init_todd_coxeter
14621618
0 commit comments