def find_nodes(graph, filter_fn):
    """
    Find all nodes whose names pass the predicate :filter_fn.
    """
    nodes = set()
    for node in graph.nodes.values():
        if filter_fn(node.name):
            nodes.add(node)
    return nodes