Python networkx 模块,dfs_tree() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用networkx.dfs_tree()

项目:pyBN    作者:ncullen93    | 项目源码 | 文件源码
def dfs_postorder(self, root):
        G = nx.Graph(self.E)
        tree_graph = nx.dfs_tree(G,root)
        clique_ordering = list(nx.dfs_postorder_nodes(tree_graph,root))
        return clique_ordering
项目:Deep-Subspace-Clustering    作者:tonyabracadabra    | 项目源码 | 文件源码
def main():
    func_list = parse.parse(open(sys.argv[1]).read())
    G = foo(func_list)
    #G = callgraph(func_list)
    nx.write_dot(G,"G.dot")
    #H = nx.dfs_tree(G,'solver')
    #nx.write_dot(H,"H.dot")
    #print nx.topological_sort(H)
项目:ride    作者:KyleBenson    | 项目源码 | 文件源码
def _trim_subtree(self, tree, root):
        """Trims off and returns a subtree rooted at root. Updates all
        necessary internal state.
        :param tree:
        :type tree: nx.DiGraph
        :param root:
        :return: subtree rooted at root
        """
        subtree = nx.dfs_tree(tree, root)
        self._update_bookkeeping(subtree, root)
        tree.remove_nodes_from(subtree.nodes())
        return subtree