produceGraph.py
def computeDifferentionFromSolutionsMatrix(submits, use_visited: bool):
    """
    for each submit, compute its difference from all solutions,
    so the output matrix is N_SUBMITS x N_SOLUTIONS

    :param submits
    :param use_visited: see global variable USE_VISITED
    :return: difference matrix
    """
    
    solutions = [submit for submit in submits if submit.flowers_left == 0]
    print("{} solutions".format(len(solutions)))

    matrix = np.zeros((len(submits), len(solutions)))
    
    for i in range(len(submits)):
        print(i)

        for s in range(len(solutions)):
            dist = 0
            if use_visited:
                str1 = submits[i].visited_to_unicode(100)
                str2 = solutions[s].visited_to_unicode(100)

                dist = StringMatcher.distance(str1, str2)
            else:
                str1 = submits[i].functions_to_unicode(use_canonized=True)
                str2 = solutions[s].functions_to_unicode(use_canonized=True)

                dist = StringMatcher.distance(str1, str2)

            matrix[i, s] = dist

    return matrix

    for each submit, compute its difference from all solutions,
    so the output matrix is N_SUBMITS x N_SOLUTIONS

    :param submits
    :param use_visited: see global variable USE_VISITED
    :return: difference matrix
    
for each submit, compute its difference from all solutions,
so the output matrix is N_SUBMITS x N_SOLUTIONS


for each submit compute its difference from all solutions so the output matrix is N_SUBMITS x N_SOLUTIONS
def computeDifferentionFromSolutionsMatrix(submits, use_visited: bool):
    solutions = [submit for submit in submits if submit.flowers_left == 0]
    print("{} solutions".format(len(solutions)))
    matrix = np.zeros((len(submits), len(solutions)))
    for i in range(len(submits)):
        print(i)
        for s in range(len(solutions)):
            dist = 0
            if use_visited:
                str1 = submits[i].visited_to_unicode(100)
                str2 = solutions[s].visited_to_unicode(100)
                dist = StringMatcher.distance(str1, str2)
            else:
                str1 = submits[i].functions_to_unicode(use_canonized=True)
                str2 = solutions[s].functions_to_unicode(use_canonized=True)
                dist = StringMatcher.distance(str1, str2)
            matrix[i, s] = dist
    return matrix
def computeDifferentionFromSolutionsMatrix ( submits , use_visited : bool ) : solutions = [ submit for submit in submits if submit . flowers_left == 0 ] print ( "{} solutions" . format ( len ( solutions ) ) ) matrix = np . zeros ( ( len ( submits ) , len ( solutions ) ) ) for i in range ( len ( submits ) ) : print ( i ) for s in range ( len ( solutions ) ) : dist = 0 if use_visited : str1 = submits [ i ] . visited_to_unicode ( 100 ) str2 = solutions [ s ] . visited_to_unicode ( 100 ) dist = StringMatcher . distance ( str1 , str2 ) else : str1 = submits [ i ] . functions_to_unicode ( use_canonized = True ) str2 = solutions [ s ] . functions_to_unicode ( use_canonized = True ) dist = StringMatcher . distance ( str1 , str2 ) matrix [ i , s ] = dist return matrix
for each submit, compute its difference from all solutions,
so the output matrix is N_SUBMITS x N_SOLUTIONS
for each submit compute its difference from all solutions so the output matrix is N_SUBMITS x N_SOLUTIONS
"""
    for each submit, compute its difference from all solutions,
    so the output matrix is N_SUBMITS x N_SOLUTIONS

    :param submits
    :param use_visited: see global variable USE_VISITED
    :return: difference matrix
    """
submits
use_visited
bool