diff --git a/src/sage/combinat/rigged_configurations/bij_abstract_class.py b/src/sage/combinat/rigged_configurations/bij_abstract_class.py index 10140d1b6b2..30292da22ee 100644 --- a/src/sage/combinat/rigged_configurations/bij_abstract_class.py +++ b/src/sage/combinat/rigged_configurations/bij_abstract_class.py @@ -311,6 +311,11 @@ def __init__(self, RC_element): # TODO: Convert from cur_partitions to rigged_con self.cur_partitions = deepcopy(list(self.rigged_con)[:]) + # This is a dummy edge to start the process + cp = RC_element.__copy__() + cp.set_immutable() + self._graph = [ [[], (cp, 0)] ] + # Compute the current L matrix # self.L = {} # for dim in self.rigged_con.parent().dims: @@ -341,15 +346,17 @@ def __eq__(self, rhs): """ return isinstance(rhs, RCToKRTBijectionAbstract) - def run(self, verbose=False): + def run(self, verbose=False, build_graph=False): """ Run the bijection from rigged configurations to tensor product of KR tableaux. INPUT: - - ``verbose`` -- (Default: ``False``) Display each step in the + - ``verbose`` -- (default: ``False``) display each step in the bijection + - ``build_graph`` -- (default: ``False``) build the graph of each + step in the bijection EXAMPLES:: @@ -390,6 +397,10 @@ def run(self, verbose=False): for a in range(self.n): self._update_vacancy_numbers(a) + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls']) + while self.cur_dims[0][0] > 0: if verbose: print("====================") @@ -404,8 +415,20 @@ def run(self, verbose=False): # Make sure we have a crystal letter ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + self.cur_dims.pop(0) # Pop off the leading column + if build_graph: + self._graph.pop(0) # Remove the dummy at the start + from sage.graphs.digraph import DiGraph + from sage.graphs.dot2tex_utils import have_dot2tex + self._graph = DiGraph(self._graph) + if have_dot2tex(): + self._graph.set_latex_options(format="dot2tex", edge_labels=True) + # Basic check to make sure we end with the empty configuration #tot_len = sum([len(rp) for rp in self.cur_partitions]) #if tot_len != 0: diff --git a/src/sage/combinat/rigged_configurations/bij_type_B.py b/src/sage/combinat/rigged_configurations/bij_type_B.py index a1c6fa028cb..ea1e3ea0192 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_B.py +++ b/src/sage/combinat/rigged_configurations/bij_type_B.py @@ -524,15 +524,17 @@ class RCToKRTBijectionTypeB(RCToKRTBijectionTypeC): Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `B_n^{(1)}`. """ - def run(self, verbose=False): + def run(self, verbose=False, build_graph=False): """ Run the bijection from rigged configurations to tensor product of KR tableaux for type `B_n^{(1)}`. INPUT: - - ``verbose`` -- (Default: ``False``) Display each step in the + - ``verbose`` -- (default: ``False``) display each step in the bijection + - ``build_graph`` -- (default: ``False``) build the graph of each + step in the bijection EXAMPLES:: @@ -589,6 +591,10 @@ def run(self, verbose=False): bij.cur_partitions[i]._list[j] *= 2 bij.cur_partitions[i].rigging[j] *= 2 bij.cur_partitions[i].vacancy_numbers[j] *= 2 + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x']) # Perform the type A_{2n-1}^{(2)} bijection @@ -603,6 +609,10 @@ def run(self, verbose=False): # All it does is update the vacancy numbers on the RC side for a in range(self.n): bij._update_vacancy_numbers(a) + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls']) while bij.cur_dims[0][0] > 0: if verbose: @@ -617,6 +627,10 @@ def run(self, verbose=False): # Make sure we have a crystal letter ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + bij.cur_dims.pop(0) # Pop off the leading column self.cur_dims.pop(0) # Pop off the spin rectangle @@ -639,6 +653,10 @@ def run(self, verbose=False): self.cur_partitions[i]._list[j] //= 2 self.cur_partitions[i].rigging[j] //= 2 self.cur_partitions[i].vacancy_numbers[j] //= 2 + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '1/2x']) else: # Perform the regular type B_n^{(1)} bijection @@ -662,6 +680,10 @@ def run(self, verbose=False): for a in range(self.n): self._update_vacancy_numbers(a) + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x']) + while self.cur_dims[0][0] > 0: if verbose: print("====================") @@ -676,8 +698,20 @@ def run(self, verbose=False): # Make sure we have a crystal letter ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + self.cur_dims.pop(0) # Pop off the leading column + if build_graph: + self._graph.pop(0) # Remove the dummy at the start + from sage.graphs.digraph import DiGraph + from sage.graphs.dot2tex_utils import have_dot2tex + self._graph = DiGraph(self._graph) + if have_dot2tex(): + self._graph.set_latex_options(format="dot2tex", edge_labels=True) + return self.KRT(pathlist=ret_crystal_path) def next_state(self, height): diff --git a/src/sage/combinat/rigged_configurations/bij_type_D.py b/src/sage/combinat/rigged_configurations/bij_type_D.py index 4da88876953..f8b1a19cd4f 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D.py @@ -414,15 +414,17 @@ class RCToKRTBijectionTypeD(RCToKRTBijectionTypeA): r""" Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `D_n^{(1)}`. """ - def run(self, verbose=False): + def run(self, verbose=False, build_graph=False): """ Run the bijection from rigged configurations to tensor product of KR tableaux for type `D_n^{(1)}`. INPUT: - - ``verbose`` -- (Default: ``False``) Display each step in the + - ``verbose`` -- (default: ``False``) display each step in the bijection + - ``build_graph`` -- (default: ``False``) build the graph of each + step in the bijection EXAMPLES:: @@ -455,6 +457,10 @@ def run(self, verbose=False): for a in range(self.n): self._update_vacancy_numbers(a) + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls']) + # Check to see if we are a spinor if dim[0] >= self.n - 1: if verbose: @@ -465,6 +471,11 @@ def run(self, verbose=False): print("--------------------\n") print("Applying doubling map") self.doubling_map() + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x']) + if dim[0] == self.n - 1: if verbose: print("====================") @@ -477,6 +488,10 @@ def run(self, verbose=False): b = -self.n ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + while self.cur_dims[0][0] > 0: if verbose: print("====================") @@ -496,6 +511,10 @@ def run(self, verbose=False): # Make sure we have a crystal letter ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + self.cur_dims.pop(0) # Pop off the leading column # Check to see if we were a spinor @@ -508,6 +527,19 @@ def run(self, verbose=False): print("--------------------\n") print("Applying halving map") self.halving_map() + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '1/2x']) + + if build_graph: + self._graph.pop(0) # Remove the dummy at the start + from sage.graphs.digraph import DiGraph + from sage.graphs.dot2tex_utils import have_dot2tex + self._graph = DiGraph(self._graph) + if have_dot2tex(): + self._graph.set_latex_options(format="dot2tex", edge_labels=True) + return self.KRT(pathlist=ret_crystal_path) def next_state(self, height): diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py index 0796a8f6819..accf74e60bc 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py @@ -310,15 +310,17 @@ class RCToKRTBijectionTypeDTwisted(RCToKRTBijectionTypeD, RCToKRTBijectionTypeA2 Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `D_{n+1}^{(2)}`. """ - def run(self, verbose=False): + def run(self, verbose=False, build_graph=False): """ Run the bijection from rigged configurations to tensor product of KR tableaux for type `D_{n+1}^{(2)}`. INPUT: - - ``verbose`` -- (Default: ``False``) Display each step in the + - ``verbose`` -- (default: ``False``) display each step in the bijection + - ``build_graph`` -- (default: ``False``) build the graph of each + step in the bijection EXAMPLES:: @@ -351,6 +353,10 @@ def run(self, verbose=False): for a in range(self.n): self._update_vacancy_numbers(a) + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls']) + # Check to see if we are a spinor if dim[0] == self.n: if verbose: @@ -362,6 +368,10 @@ def run(self, verbose=False): print("Applying doubling map") self.doubling_map() + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x']) + while self.cur_dims[0][0] > 0: if verbose: print("====================") @@ -376,6 +386,10 @@ def run(self, verbose=False): # Make sure we have a crystal letter ret_crystal_path[-1].append(letters(b)) # Append the rank + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)]) + self.cur_dims.pop(0) # Pop off the leading column # Check to see if we were a spinor @@ -388,6 +402,19 @@ def run(self, verbose=False): print("--------------------\n") print("Applying halving map") self.halving_map() + + if build_graph: + y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions]) + self._graph.append([self._graph[-1][1], (y, len(self._graph)), '1/2x']) + + if build_graph: + self._graph.pop(0) # Remove the dummy at the start + from sage.graphs.digraph import DiGraph + from sage.graphs.dot2tex_utils import have_dot2tex + self._graph = DiGraph(self._graph) + if have_dot2tex(): + self._graph.set_latex_options(format="dot2tex", edge_labels=True) + return self.KRT(pathlist=ret_crystal_path) def next_state(self, height): diff --git a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py index 5c845cf611b..9e10c024da2 100644 --- a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py +++ b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py @@ -493,7 +493,7 @@ def check(self): if vac_num < partition.rigging[i]: raise ValueError("rigging can be at most the vacancy number") - def to_tensor_product_of_kirillov_reshetikhin_tableaux(self, display_steps=False): + def to_tensor_product_of_kirillov_reshetikhin_tableaux(self, display_steps=False, build_graph=False): r""" Perform the bijection from this rigged configuration to a tensor product of Kirillov-Reshetikhin tableaux given in [RigConBijection]_ @@ -510,6 +510,8 @@ def to_tensor_product_of_kirillov_reshetikhin_tableaux(self, display_steps=False - ``display_steps`` -- (default: ``False``) boolean which indicates if we want to output each step in the algorithm + - ``build_graph` -- (default: ``False``) boolean which indicates + if we want to construct and return a graph of the bijection OUTPUT: @@ -544,7 +546,11 @@ def to_tensor_product_of_kirillov_reshetikhin_tableaux(self, display_steps=False True """ from sage.combinat.rigged_configurations.bijection import RCToKRTBijection - return RCToKRTBijection(self).run(display_steps) + bij = RCToKRTBijection(self) + ret = bij.run(display_steps, build_graph) + if build_graph: + return (ret, bij._graph) + return ret def to_tensor_product_of_kirillov_reshetikhin_crystals(self, display_steps=False): r"""