def getDistMat(link, links):
		distmat = []
		global pages
		#pages = getPages(links)
		for link2 in links:
				if link == link2:
						distmat += [0.0]
				else:
						temp = getSimilarityValue(pages[link], pages[link2])
						distmat += [temp]
		return (link, distmat)
def getDistMat(links):
    distmat = []
    cache = {}
    # global pages
    pages = getPages(links)
    for link1 in links:
        row = []
        for link2 in links:
            if link1 == link2:
                row += [0.0]
                continue
            if (link1, link2) in cache:
                row += [cache[(link1, link2)]]
            else:
                temp = getSimilarityValue(pages[link1], pages[link2])
                cache[(link1, link2)] = temp
                row += [temp]
        distmat += [row]
        print link1
    return distmat