コード例 #1
0
    def detect_concurrent(self):
        if self.contains_empty_trace():
            return [False, []]
        inverted_dfg = [
        ]  # create an inverted dfg, the connected components of this dfg are the split
        for a in self.activities:
            for b in self.activities:
                if a != b:
                    if not self.is_followed_by(self.dfg, a,
                                               b) or not self.is_followed_by(
                                                   self.dfg, b, a):
                        if ((a, b), 1) not in inverted_dfg:
                            inverted_dfg.append(((a, b), 1))
                            inverted_dfg.append(((b, a), 1))
        self.inverted_dfg = inverted_dfg
        new_ingoing = get_ingoing_edges(inverted_dfg)
        new_outgoing = get_outgoing_edges(inverted_dfg)
        conn = detection_utils.get_connected_components(
            new_ingoing, new_outgoing, self.activities)
        if len(conn) > 1:
            conn = parallel_cut_utils.check_par_cut(conn, self.ingoing,
                                                    self.outgoing)
            if len(conn) > 1:
                if parallel_cut_utils.check_sa_ea_for_each_branch(
                        conn, self.start_activities, self.end_activities):
                    return [True, conn]

        return [False, []]
コード例 #2
0
    def detect_parallel_cut(self, orig_conn_components, this_nx_graph,
                            strongly_connected_components):
        """
        Detects parallel cut

        Parameters
        --------------
        orig_conn_components
            Connected components of the graph
        this_nx_graph
            NX graph calculated on the DFG
        strongly_connected_components
            Strongly connected components
        """
        conn_components = detection_utils.get_connected_components(
            self.negated_ingoing, self.negated_outgoing, self.activities)

        if len(conn_components) > 1:
            conn_components = parallel_cut_utils.check_par_cut(
                conn_components, self.ingoing, self.outgoing)

            if self.check_sa_ea_for_each_branch(conn_components):
                return [True, conn_components]

        return [False, []]