file
Tangles.hdeclares the class Tangle
Classes
Typedefs
- using Cut = std::vector<bool>
- a list of boolean values, representing oriented intersection points of a straight horizontal line with a generic oriented tangle diagram.
- using Slice = std::pair<char, int>
- represents an elementary tangle in a Morse presentation of a tangle
- using tangle_input = std::pair<std::string, Cut>
- defines an oriented tangle
Functions
- void cleanup_move(std::vector<Slice>& slices)
- pushes cups up as far as possible
- auto erase_cup_down_or_cap_up(std::vector<Slice>& slices, size_t& level, int& i, int& j) -> bool
- erases the strands at indices i and j at the top of a cup/bottom of a cap.
- void erase_cup_up_or_cap_down(std::vector<Slice>& slices, size_t& level, int& i, int& j)
- erases the strands at indices i and j at the bottom of a cup/top of a cap.
- auto erase_x_or_y(std::vector<Slice>& slices, size_t& level, int& i, int& j) -> bool
- erases the strands at indices i and j at a slice x or y.
- auto find_cap(const std::vector<Slice>& slices, size_t level, int index, char& ou_char, const size_t& uptolevel) -> std::pair<size_t, int>
- auto find_cup(const std::vector<Slice>& slices, size_t level, int index, char& ou_char, const size_t& uptolevel) -> std::pair<size_t, int>
- void flip_slices(std::vector<Slice>& slices, const int& level)
- auto follow_strand_down(const std::vector<Slice>& slices, const bool& symmetry, size_t& level, int& index) -> char
- auto follow_strand_up(const std::vector<Slice>& slices, const bool& symmetry, size_t& level, int& index) -> char
- auto global_move(std::vector<Slice>& slices) -> bool
- attempts to remove a cap-cup pair
- void interactive(const std::string& metadata, std::vector<File>& files)
- User dialogue for generating tangles and storing them for later use.
- auto interactive_file(const std::string& defaultpath = "") -> File
- User dialogue for specifying a file (path)
- auto ou_helper(char& c1, const char& c2) -> bool
- void push_cap(std::vector<Slice>& slices, size_t level)
- eliminate cup-cap pair by pushing cap downwards through the tangle.
- void push_cup(std::vector<Slice>& slices, size_t level)
- eliminate cup-cap pair by pushing cup upwards through the tangle.
- void rational_knot(const int& p, const int& q, const std::string& name, const std::string& metadata, std::vector<File>& files)
- generate a diagram for the 2-bridge knot corresponding to the fraction p/q; we will assume |p|>q>0.
- void rational_quotient(const int& p, const int& q, const std::string& name, const std::string& metadata, std::vector<File>& files)
- generate diagrams for all strong inversions of the 2-bridge knot corresponding to the fraction p/q; we will assume |p|>q>0; see [9].
- auto rational_tangle(const int& p, const int& q) -> Tangle
- generates a rational tangle of slope p/q
- auto Sakuma(const std::vector<int>& list) -> Tangle
- generates a symmetric knot corresponding to from [9].
- auto Sakuma(const std::vector<int>& list1, const std::vector<int>& list2) -> Tangle
- generates a symmetric knot corresponding to from [9].
- auto simplification_move(std::vector<Slice>& slices) -> bool
- attempts to apply Reidemeister I and II moves to reduce the number of crossings
- auto simplify(std::string tanglestring, int cutlength) -> std::string
- attempts to simplify a tangle string. This function should not be called if the
tanglestring
defines a symmetric tangle. - auto slices_to_string(std::vector<Slice> slices) -> std::string
- concatenates slices along dots (.)
- auto to_slices(std::string tanglestring, int cutlength) -> std::vector<Slice>
- list of slices generated from a tangle string (ame format as the first component of tangle_
input). This function will throw error messages if the input is inconsistent. cutlength
is the number of top tangle ends - void wiggle_move(std::vector<Slice>& slices)
- pushes randomly selected slice randomly up or down as far as possible and then attempts to perform a Reidemeister III move or a 'wiggle move' (interchanging x- and y crossings above cups or below caps)
Typedef documentation
typedef std::vector<bool> Cut
a list of boolean values, representing oriented intersection points of a straight horizontal line with a generic oriented tangle diagram.
The boolean values are translated as follows:
- 1=↑
- 0=↓
typedef std::pair<char, int> Slice
represents an elementary tangle in a Morse presentation of a tangle
The first entry is either x
, y
, l
, r
, u
. These characters are translated into elementary tangles as follows:
x
: ⤬ (crossing with over-strand starting at top left corner)y
: ⤫ (crossing with over-strand starting at top right corner)l
: ↶ (cap, oriented to the left)r
: ↷ (cap, oriented to the right)u
: ∪ (cup)
The second entry is the index of the left strand in a crossing/cap/cup, counted from the left, starting at 0.
typedef std::pair<std::string, Cut> tangle_input
defines an oriented tangle
The first entry is a string which is a dot(.)-separated sequence of words of the form ci
where the pair (c
,i
) defines a Slice. The word represents the elementary tangle in a Morse presentation of the tangle, read from top to bottom. For symmetric knots, the prefix "s." should be added to this string. The second entry is a Cut corresponding to the top of the tangle.
For example,
tangle_input={"l1.x2.y0.x2.y0.x2.u1",{1,1}}
corresponds to the tangle
and
tangle_input={"s.l1.y0.y0.x1.u2",{1}}
corresponds to the symmetric knot
Function documentation
bool erase_cup_down_or_cap_up(std::vector<Slice>& slices, size_t& level, int& i, int& j)
erases the strands at indices i and j at the top of a cup/bottom of a cap.
Returns true if slice was erased and updates all inputs. The relation i<j is assumed as for input and guaranteed for output. This function does not check if the move preserves the tangle type. It is only used in push_cup and push_cap;
void erase_cup_up_or_cap_down(std::vector<Slice>& slices, size_t& level, int& i, int& j)
erases the strands at indices i and j at the bottom of a cup/top of a cap.
This function never erases a slice. The relation i<j is assumed as for input and guaranteed for output. This function does not check if the move preserves the tangle type. It is only used in push_cup and push_cap;
bool erase_x_or_y(std::vector<Slice>& slices, size_t& level, int& i, int& j)
erases the strands at indices i and j at a slice x or y.
Returns true if slice was erased and updates all inputs; The relation i<j is assumed as for input and guaranteed for output. This function does not check if the move preserves the tangle type. It is only used in push_cup and push_cap;
std::pair<size_t, int> find_cap(const std::vector<Slice>& slices, size_t level, int index, char& ou_char, const size_t& uptolevel)
returns level and index of the strand coming out of the first cap that we meet along the upwards path from the point a given level and index, if the strand remains always above or always below all other strands; returns (0,0) otherwise. This function is only used in global_move;
std::pair<size_t, int> find_cup(const std::vector<Slice>& slices, size_t level, int index, char& ou_char, const size_t& uptolevel)
returns level and index of the strand coming out of the first cup that we meet along the downwards path from the point a given level and index, if the strand remains always above or always below all other strands; returns (0,0) otherwise. This function is only used in global_move;
void flip_slices(std::vector<Slice>& slices, const int& level)
interchange two slices
This function does not check if the move preserves the tangle type. It is only used in wiggle_
char follow_strand_down(const std::vector<Slice>& slices, const bool& symmetry, size_t& level, int& index)
follows a strand at a given level and index one step down
returns 'u' if there is a cup at the next level and index, 'U' or 'O' if the strand is involved in an under/over crossing, respectively, and 'a' otherwise. level and index are updated input level must be at most slices.size()-1
char follow_strand_up(const std::vector<Slice>& slices, const bool& symmetry, size_t& level, int& index)
follows a strand at a given level and index one step up
returns 'r' or 'l' if there is a cap at the next level and index, or 'a' otherwise. 'l' is returned iff the cap is 'r'. Level and index are updated input level must be > 0
void interactive(const std::string& metadata, std::vector<File>& files)
User dialogue for generating tangles and storing them for later use.
bool ou_helper(char& c1, const char& c2)
helper function to keep track of over/under strands
if c1 in {O,U}, true if and only if c2=c1 or c1 not in {O,U}. if c1 not in {O,U}, c1=c2
void push_cap(std::vector<Slice>& slices, size_t level)
eliminate cup-cap pair by pushing cap downwards through the tangle.
If cup-cap pair gives closed component, we add a single cap and cup below the whole tangle afterwards. This function does not check if the move preserves the tangle type. It is only used in global_move.
void push_cup(std::vector<Slice>& slices, size_t level)
eliminate cup-cap pair by pushing cup upwards through the tangle.
If cup-cap pair gives closed component, we add a single cap and cup below the whole tangle afterwards. This function does not check if the move preserves the tangle type. It is only used in global_move.