<commit_before>(function(){

  window.FSTraversalRelationshipDisplay = function(traversalPath){
  
    // Setup more simple data structure
    var path = [{
      person: traversalPath[0],
      relationship: ''
    }];
    for(var i = 1; i < traversalPath.length; i += 2){
      path.push({
        person: traversalPath[i+1],
        relationship: traversalPath[i]
      });
    }
    
    // Calculate height
    var prevHeight = path[0].height = 0;
    var prevChange = path[0].change = 0;
    path[0].corner = false;
    for(var i = 1; i < path.length; i++){
      var change = 0;
      switch(path[i].relationship){
        case 'child':
          change = -1;
          break;
        case 'mother':
        case 'father':
          change = 1;
          break;
      }
      prevHeight = path[i].height = prevHeight + change;
      path[i-1].corner = (change === 1 && prevChange === -1) || (prevChange === 1 && change === -1);
      prevChange = path[i].change = change;
    }
    path[path.length-1].corner = false;
    
    // Calculate left
    var prevLeft = path[0].left = 0;
    for(var i = 1; i < path.length-1; i++){
      var change = 0;
      if(path[i-1].corner || path[i].corner){
        change = .5;
      }
      else if(path[i].relationship === 'spouse'){
        change = 1;
      }
      prevLeft = path[i].left = prevLeft + change;
    }
    
    console.log(path);
  };

}());<commit_msg>Adjust heights so min is 0<commit_after>(function(){

  window.FSTraversalRelationshipDisplay = function(traversalPath){
  
    // Setup more simple data structure
    var path = [{
      person: traversalPath[0],
      relationship: ''
    }];
    for(var i = 1; i < traversalPath.length; i += 2){
      path.push({
        person: traversalPath[i+1],
        relationship: traversalPath[i]
      });
    }
    
    // Calculate height
    var prevHeight = path[0].height = 0;
    var prevChange = 0;
    var minHeight = 0;
    path[0].corner = false;
    for(var i = 1; i < path.length; i++){
      var change = 0;
      switch(path[i].relationship){
        case 'child':
          change = -1;
          break;
        case 'mother':
        case 'father':
          change = 1;
          break;
      }
      prevHeight = path[i].height = prevHeight + change;
      minHeight = Math.min(prevHeight, minHeight);
      path[i-1].corner = (change === 1 && prevChange === -1) || (prevChange === 1 && change === -1);
      prevChange = change;
    }
    path[path.length-1].corner = false;
    
    // Adjust heights so that the minimum is 0
    if(minHeight < 0){
      var change = Math.abs(minHeight);
      for(var i = 0; i < path.length; i++){
        path[i].height += change;
      }
    }
    
    // Calculate left
    var prevLeft = path[0].left = 0;
    for(var i = 1; i < path.length-1; i++){
      var change = 0;
      if(path[i-1].corner || path[i].corner){
        change = .5;
      }
      else if(path[i].relationship === 'spouse'){
        change = 1;
      }
      prevLeft = path[i].left = prevLeft + change;
    }
    
    console.log(path);
  };

}());
{'fraction_non_alphanumeric': 0.15620957309184993, 'fraction_numerical': 0.018758085381630013, 'mean_word_length': 1.9345351043643264, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5307734', 'n_tokens_mistral': 1050, 'n_tokens_neox': 991, 'n_words': 242}