Returns all cliques in the graph with at least the given number of nodes.
(graph, threshold=3)
| 1022 | return a |
| 1023 | |
| 1024 | def cliques(graph, threshold=3): |
| 1025 | """ Returns all cliques in the graph with at least the given number of nodes. |
| 1026 | """ |
| 1027 | a = [] |
| 1028 | for n in graph.nodes: |
| 1029 | c = clique(graph, n.id) |
| 1030 | if len(c) >= threshold: |
| 1031 | c.sort() |
| 1032 | if c not in a: a.append(c) |
| 1033 | return a |
| 1034 | |
| 1035 | #--- GRAPH MAINTENANCE ----------------------------------------------------------------------------- |
| 1036 | # Utility functions for safe linking and unlinking of nodes, |