sources/modules/Tangles.cpp file

implements the class Tangles

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 $I_2(a_1,\dots,a_n)$ from [9].
auto Sakuma(const std::vector<int>& list1, const std::vector<int>& list2) -> Tangle
generates a symmetric knot corresponding to $I_1(a_1,\dots,a_n:c_1,\dots,c_n)$ 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)

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_move().

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.