A graph G=(V,E,l) satisfies the triangle inequality if for any three vertices u,v,w∈V l(u,v)+l(v,w)≥l(u,w).