quilt_knit.swatch.Seam_Search_Space module

Module Containing the Seam Search Space class.

class Seam_Search_Space(from_swatch, to_swatch)[source]

Bases: object

Super class representing a network of possible connections between two merged swatches.

seam_network

The network of boundary instructions that form allowed connections between swatches.

Type:

DiGraph

instructions_to_boundary_instruction

Dictionary of Knitout instructions to their corresponding boundary instruction.

Type:

dict[Knitout_line, Swatch_Boundary_Instruction]

Parameters:
__init__(from_swatch, to_swatch)[source]
Parameters:
remove_boundary(instruction)[source]

Removes any boundary instruction associated with the given instruction from the search space. If the instruction does not belong to a boundary, nothing happens.

Parameters:

instruction (Knitout_Line) – The boundary instruction to remove from the search space.

Returns:

The boundary instruction that was removed or None, if no boundary was found by that instruction.

Return type:

Swatch_Boundary_Instruction | None

available_connections(boundary_instruction)[source]
Parameters:

boundary_instruction (Wale_Boundary_Instruction) – The boundary instruction to find the available connections to.

Returns:

A list of all available connections to the given instruction. If this is an exit, only entrance instructions will be returned. If it is an entrance, only exits will be returned.

Return type:

set[Seam_Connection]