This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/twilight");e.getSession().setMode("ace/mode/python");</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_all_cycles(G, source=None, cycle_length_limit=None): | |
"""forked from networkx dfs_edges function. Assumes nodes are integers, or at least | |
types which work with min() and > .""" | |
if source is None: | |
# produce edges for all components | |
nodes=[i[0] for i in nx.connected_components(G)] | |
else: | |
# produce edges for components with source | |
nodes=[source] | |
# extra variables for cycle detection: |