def traverse_graph(node, move_fn, stop_criteria_fn=None, criteria_fns=None):
    """ Traverse through graph dependent on move_fn
    :param node: node to start floating or sinking with some rule
    :param move_fn: function to get relatives (children, parents or some subset of them)
    to make traverse through graph. Function should have node as argument.
    You can make traverse up/down or whatever you want using this function.
    :param stop_criteria_fn: function to stop traversing and return boolean result.
    Function should have node as argument.
    :param criteria_fns: list of functions or just function with specified criteria for nodes.
    Returns True if criteria was satisfied at least at one node, False otherwise
    :return pair of values. The first one is a boolean value. In case stop criteria was satisfied
    the value is True, False otherwise.
    The second value is a dict of criteria values. The keys are function itself, node names where
    criteria was satisfied is used as dict values.
     """

    if criteria_fns and callable(criteria_fns):
        criteria_fns = [criteria_fns]

    criteria_res = {}

    def apply_criteria_fn(n):
        if not criteria_fns:
            return
        for fn in criteria_fns:
            node_name = n.name if fn(n) else None
            if node_name:
                if fn in criteria_res:
                    criteria_res[fn].append(node_name)
                else:
                    criteria_res[fn] = [node_name]

    def stop_traverse_fn(n):
        if stop_criteria_fn:
            return stop_criteria_fn(n)
        return False

    queue, visited = [node], []

    while queue:
        current_node = queue.pop(0)
        if current_node.name in visited:
            continue

        relatives = move_fn(current_node)
        visited.append(current_node.name)

        if relatives:
            for r in relatives:
                apply_criteria_fn(r)
                if stop_traverse_fn(r):
                    return True, criteria_res
        queue += relatives
    return False, criteria_res