def build_graph(formula):
graph = {}<EOL>for clause in formula:<EOL><INDENT>for (lit, _) in clause:<EOL><INDENT>for neg in [False, True]:<EOL><INDENT>graph[(lit, neg)] = []<EOL><DEDENT><DEDENT><DEDENT>for ((a_lit, a_neg), (b_lit, b_neg)) in formula:<EOL><INDENT>add_edge(graph, (a_lit, a_neg), (b_lit, not b_neg))<EOL>add_edge(graph, (b_lit, b_neg), (a_lit, not a_neg))<EOL><DEDENT>return graph<EOL>
Builds the implication graph from the formula