This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from https://webapps.stackexchange.com/questions/84218/sorting-alphabetically-a-z-ignoring-beginning-a-an-and-the-using-a-scri | |
function sortByTitle() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
// Ignore header row (A1:Z1) | |
var range = sheet.getRange(2, 1, sheet.getLastRow() - 1, sheet.getLastColumn()); | |
var values = range.getValues(); | |
values.sort(function(a,b) {return (trimmed(a[0]) < trimmed(b[0]) ? -1 : 1);}); | |
range.setValues(values); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm | |
def get_sccs(graph=None): | |
""" Check for strongly connected components using Tarjan's algorithm""" | |
# set up graph | |
# graph = {1: [2], 2: [3], 3: [2], 4: []} | |
sccs = [] | |
index = 0 | |
indices = {} | |
lowlinks = {} | |
onstack = set() |