def is_edge(s, t, k):
    """There is an edge from s to t if there is a length k suffix of s that
    matches a length k prefix as t (and s != t).
    """
    if s == t:
        return False
    else:
        return (s[1][-k:] == t[1][:k])