def find_reachable(rdf, res):
starttime = time.time()<EOL>seen = set()   <EOL>to_search = set([res])  <EOL>while len(to_search) > <NUM_LIT:0>:<EOL><INDENT>res = to_search.pop()<EOL>if res in seen:<EOL><INDENT>continue<EOL><DEDENT>seen.add(res)<EOL>for p, o in rdf.predicate_objects(res):<EOL><INDENT>if isinstance(p, URIRef) and p not in seen:<EOL><INDENT>to_search.add(p)<EOL><DEDENT>if isinstance(o, URIRef) and o not in seen:<EOL><INDENT>to_search.add(o)<EOL><DEDENT><DEDENT>for s, o in rdf.subject_objects(res):<EOL><INDENT>if isinstance(s, URIRef) and s not in seen:<EOL><INDENT>to_search.add(s)<EOL><DEDENT>if isinstance(o, URIRef) and o not in seen:<EOL><INDENT>to_search.add(o)<EOL><DEDENT><DEDENT>for s, p in rdf.subject_predicates(res):<EOL><INDENT>if isinstance(s, URIRef) and s not in seen:<EOL><INDENT>to_search.add(s)<EOL><DEDENT>if isinstance(p, URIRef) and p not in seen:<EOL><INDENT>to_search.add(p)<EOL><DEDENT><DEDENT><DEDENT>endtime = time.time()<EOL>logging.debug("<STR_LIT>", (endtime - starttime))<EOL>return seen<EOL>
Return the set of reachable resources starting from the given resource,
    excluding the seen set of resources.

    Note that the seen set is modified
    in-place to reflect the ongoing traversal.