def objects_reachable_from(obj):
    """
    Return graph of objects reachable from *obj* via ``gc.get_referrers``.

    Returns an :class:`~refcycle.object_graph.ObjectGraph` object holding all
    objects reachable from the given one by following the output of
    ``gc.get_referrers``.  Note that unlike the
    :func:`~refcycle.creators.snapshot` function, the output graph may
    include non-gc-tracked objects.

    """
    # Depth-first search.
    found = ObjectGraph.vertex_set()
    to_process = [obj]
    while to_process:
        obj = to_process.pop()
        found.add(obj)
        for referent in gc.get_referents(obj):
            if referent not in found:
                to_process.append(referent)
    return ObjectGraph(found)
def objects_reachable_from ( obj ) : found = ObjectGraph . vertex_set ( ) to_process = [ obj ] while to_process : obj = to_process . pop ( ) found . add ( obj ) for referent in gc . get_referents ( obj ) : if referent not in found : to_process . append ( referent ) return ObjectGraph ( found )
Return graph of objects reachable from *obj* via ``gc.get_referrers``.

    Returns an :class:`~refcycle.object_graph.ObjectGraph` object holding all
    objects reachable from the given one by following the output of
    ``gc.get_referrers``.  Note that unlike the
    :func:`~refcycle.creators.snapshot` function, the output graph may
    include non-gc-tracked objects.