def get_triangles(graph: DiGraph) -> SetOfNodeTriples:
return {<EOL>tuple(sorted([a, b, c], key=str))<EOL>for a, b in graph.edges()<EOL>for c in graph.successors(b)<EOL>if graph.has_edge(c, a)<EOL>}<EOL>
Get a set of triples representing the 3-cycles from a directional graph.

    Each 3-cycle is returned once, with nodes in sorted order.