def is_consistent(graph, goalNode):
    """Returns True if this graph's heuristic is consistent; else False.
    A consistent heuristic satisfies the following property for all
    nodes v in the graph:
        Suppose v is a node in the graph, and N is a neighbor of v,
        then, heuristic(v) <= heuristic(N) + edge_weight(v, N)
    In other words, moving from one node to a neighboring node never unfairly
    decreases the heuristic.
    This is equivalent to the heuristic satisfying the triangle inequality."""
    check_consistent = True
    for edge in graph.edges:
        startNode = edge.startNode
        endNode = edge.endNode
        if graph.get_heuristic_value(startNode, goalNode) > graph.get_heuristic_value(endNode,goalNode) + edge.length:
            check_consistent = False   
    return check_consistent