Returns a list of cycles in the graph, where each cycle is its own list.
(self)
| 1709 | return list(flat_list) |
| 1710 | |
| 1711 | def FindCycles(self): |
| 1712 | """ |
| 1713 | Returns a list of cycles in the graph, where each cycle is its own list. |
| 1714 | """ |
| 1715 | results = [] |
| 1716 | visited = set() |
| 1717 | |
| 1718 | def Visit(node, path): |
| 1719 | for child in node.dependents: |
| 1720 | if child in path: |
| 1721 | results.append([child] + path[: path.index(child) + 1]) |
| 1722 | elif child not in visited: |
| 1723 | visited.add(child) |
| 1724 | Visit(child, [child] + path) |
| 1725 | |
| 1726 | visited.add(self) |
| 1727 | Visit(self, [self]) |
| 1728 | |
| 1729 | return results |
| 1730 | |
| 1731 | def DirectDependencies(self, dependencies=None): |
| 1732 | """Returns a list of just direct dependencies.""" |