From cb142f9f0e515b3db667caa1049d899646fca2d2 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Thu, 13 Dec 2018 13:37:39 -0600 Subject: [PATCH] project: Refactor pipeline What's a pipeline if not the weekly connected component subgraphs of a directed acyclic graph? --- dvc/project.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/dvc/project.py b/dvc/project.py index dce1ade24..720c10b58 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -1180,25 +1180,7 @@ class Project(object): G, G_active = self.graph() - if len(G.nodes()) == 0: - return [] - - # find pipeline ends aka "output stages" - ends = [node for node, in_degree in G.in_degree() if in_degree == 0] - - # filter out subgraphs that didn't exist in original G - pipelines = [] - for c in nx.weakly_connected_components(G_active): - H = G_active.subgraph(c) - found = False - for node in ends: - if node in H: - found = True - break - if found: - pipelines.append(H) - - return pipelines + return list(nx.weakly_connected_component_subgraphs(G_active)) def stages(self): """