Skip to content

Instantly share code, notes, and snippets.

View yingqiuz's full-sized avatar
🌱
slowly becoming a tree

Akina YQ Zheng yingqiuz

🌱
slowly becoming a tree
View GitHub Profile
@yingqiuz
yingqiuz / all_cycles_k.py
Last active November 9, 2018 03:13
find all cycles at length k
# requires python3.6 or above
# requires networkx, matplotlib
import numpy as np
import networkx as nx
import matplotlib as plt
def all_cycles_k_recursive(G, source, k, current_node, visited, cycle, allcycles):
"""
"""
# mark current node as visited