def mutual_accessibility(graph):
recursionlimit = getrecursionlimit()<EOL>setrecursionlimit(max(len(graph.nodes())*<NUM_LIT:2>,recursionlimit))<EOL>mutual_access = {}<EOL>stack = []<EOL>low = {}<EOL>def visit(node):<EOL><INDENT>if node in low:<EOL><INDENT>return<EOL><DEDENT>num = len(low)<EOL>low[node] = num<EOL>stack_pos = len(stack)<EOL>stack.append(node)<EOL>for successor in graph.neighbors(node):<EOL><INDENT>visit(successor)<EOL>low[node] = min(low[node], low[successor])<EOL><DEDENT>if num == low[node]:<EOL><INDENT>component = stack[stack_pos:]<EOL>del stack[stack_pos:]<EOL>component.sort()<EOL>for each in component:<EOL><INDENT>mutual_access[each] = component<EOL><DEDENT>for item in component:<EOL><INDENT>low[item] = len(graph)<EOL><DEDENT><DEDENT><DEDENT>for node in graph:<EOL><INDENT>visit(node)<EOL><DEDENT>setrecursionlimit(recursionlimit)<EOL>return mutual_access<EOL>
Mutual-accessibility matrix (strongly connected components).

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

@rtype:  dictionary
@return: Mutual-accessibility information for each node.