dict_editdistance.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:data-structures-algorithms-in-python 作者: nirmalthacker 项目源码 文件源码
def buildGraphDictionary(words):
    g = Graph()
    for w in words:
        g.addVertex(w)
    for i in range(len(words)):
        source = words[i]
        for w in words:
            if source == w:
                pass
            else:
                if find_edit_distance(source, w) == 1:
                    g.addEdge(source, w, 1)
    #for vertex in g:
    #   for w in vertex.getConnections():
    #       print("( %s , %s )" % (vertex.getId(), w.getId()))
    return g
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号