knit_graphs.artin_wale_braids.Wale_Group module
Module containing the Wale_Group class and its methods.
This module provides the Wale_Group class which represents a collection of interconnected wales that are joined through decrease operations, forming a tree-like structure of vertical stitch columns.
- class Wale_Group(terminal_loop, knit_graph)[source]
Bases:
object
A graph structure maintaining relationships between connected wales through decrease operations.
This class represents a collection of wales that are connected through decrease stitches, where multiple wales merge into fewer wales as the knitting progresses upward. It maintains both the wale-to-wale relationships and the individual stitch connections within the group.
- wale_graph
A directed graph representing the relationships between wales in this group.
- Type:
DiGraph
- stitch_graph
A directed graph of all individual stitch connections within this wale group.
- Type:
DiGraph
- bottom_loops
Mapping from the first (bottom) loop of each wale to the wale itself.
- Parameters:
terminal_loop (
Loop
)knit_graph (
Knit_Graph
)
- __init__(terminal_loop, knit_graph)[source]
Initialize a wale group starting from a terminal wale and building downward.
- Parameters:
terminal_loop (Loop) – The terminal loop of this wale-group. All the wales in the group connect up to this loop.
knit_graph (Knit_Graph) – The parent knit graph that contains this wale group.
- get_loops_over_courses()[source]
Get loops organized by their course (horizontal row) within this wale group.
This method traces through the stitch connections starting from the terminal wale’s top loop and groups loops by their vertical position (course) in the knitted structure.
- __len__()[source]
Get the height of the wale group measured as the maximum number of loops from base to terminal.
This method calculates the total length by summing all loops in all wales that can be reached from each bottom wale, returning the maximum total length found.
- Returns:
The height of the wale group from the base loops to the tallest terminal, measured in total number of loops.
- Return type: