A question about recursion (and tangentially the graphing library networkx): I have an directed graph with node that have edges that have an attribute ["value"] that can be 0 or 1 (effectively edge weights).
I want to be able to examine a node's neighbor recursively until a neighbor's node fails a certain threshold. For example:
def checkAll(x):
for neighbor in graph.neighbors(x):
if neighbor is bad:
fail
else:
checkAll(neighbor)
#add all good neighbors here? This isn't working!
I'm failing at recursion, basically, I think because of the way the "for" loop is done. Can I get some help? (I looked at this other SO post but it didn't seem particularly relevant?)
Thank you!