The networkx dfs_edges()
function will iterate over child nodes. As far as I can tell, the http://networkx.lanl.gov/ documentation does not specify a parameter into dfs_edges()
to only traverse if edges have a specific label.
Also, I looked at dfs_labeled_edges()
but that only tells you the traversal direction while iterating over a graph with DFS.
I have an approach which is working for me. Thanks @Aric for the inspiration.
It is a new function called dfs_edges_by_label() . And given a label as an input, it only traverses edges matching the label.