def _generate_citation_dict(graph: BELGraph) -> Mapping[str, Mapping[Tuple[BaseEntity, BaseEntity], str]]:
results = defaultdict(lambda: defaultdict(set))<EOL>for u, v, data in graph.edges(data=True):<EOL><INDENT>if CITATION not in data:<EOL><INDENT>continue<EOL><DEDENT>results[data[CITATION][CITATION_TYPE]][u, v].add(data[CITATION][CITATION_REFERENCE].strip())<EOL><DEDENT>return dict(results)<EOL>
Prepare a citation data dictionary from a graph.

    :return: A dictionary of dictionaries {citation type: {(source, target): citation reference}