Accessibility matrix (transitive closure).

    @type  graph: graph, digraph, hypergraph
    @param graph: Graph.

    @rtype:  dictionary
    @return: Accessibility information for each node.

def accessibility(graph):
    """
    Accessibility matrix (transitive closure).

    @type  graph: graph, digraph, hypergraph
    @param graph: Graph.

    @rtype:  dictionary
    @return: Accessibility information for each node.
    """
    recursionlimit = getrecursionlimit()
    setrecursionlimit(max(len(graph.nodes())*2,recursionlimit))
    
    accessibility = {}        # Accessibility matrix

    # For each node i, mark each node j if that exists a path from i to j.
    for each in graph:
        access = {}
        # Perform DFS to explore all reachable nodes
        _dfs(graph, access, 1, each)
        accessibility[each] = list(access.keys())
    
    setrecursionlimit(recursionlimit)
    return accessibility