# HG changeset patch
# User Travis Scrimshaw <tscrim@ucdavis.edu>
# Date 1381717489 25200
# Node ID 60977bc02de38f685a738edae30109bf471ac7d6
# Parent de5249006e6130e459239872a7671e93dd2a1c66
#15277: do not include edges from zeros in Dynkin diagram
diff git a/sage/combinat/root_system/dynkin_diagram.py b/sage/combinat/root_system/dynkin_diagram.py
a

b

def DynkinDiagram(*args, **kwds): 
153  153  
154  154  :func:`CartanType` for a general discussion on Cartan 
155  155  types and in particular node labeling conventions. 
 156  
 157  TESTS: 
 158  
 159  Check that :trac:`15277` is fixed by not having edges from 0's:: 
 160  
 161  sage: CM = CartanMatrix([[2,1,0,0],[3,2,2,2],[0,1,2,1],[0,1,1,2]]) 
 162  sage: CM 
 163  [ 2 1 0 0] 
 164  [3 2 2 2] 
 165  [ 0 1 2 1] 
 166  [ 0 1 1 2] 
 167  sage: CM.dynkin_diagram().edges() 
 168  [(0, 1, 3), 
 169  (1, 0, 1), 
 170  (1, 2, 1), 
 171  (1, 3, 1), 
 172  (2, 1, 2), 
 173  (2, 3, 1), 
 174  (3, 1, 2), 
 175  (3, 2, 1)] 
156  176  """ 
157  177  if len(args) == 0: 
158  178  return DynkinDiagram_class() 
… 
… 
def DynkinDiagram(*args, **kwds): 
173  193  index_set = mat.index_set() 
174  194  D = DynkinDiagram_class(index_set=index_set) 
175  195  n = mat.nrows() 
176   for i in range(n): 
177   for j in range(n): 
178   if i != j: 
179   D.add_edge(index_set[i], index_set[j], mat[j,i]) 
 196  for (i,j) in mat.nonzero_positions(): 
 197  if i != j: 
 198  D.add_edge(index_set[i], index_set[j], mat[j,i]) 
180  199  return D 
181  200  ct = CartanType(*args) 
182  201  try: 