示例#1
0
文件: g2_graph.py 项目: nilsec/mtrack
    def add_conflict(self, exclusive_vertices):
        """
        Add a tuple of exclusive vertices.
        """
        for u in exclusive_vertices:
            self.__check_id(u)

        conflicts = G.get_graph_property(self, "conflicts")
        conflicts.add(tuple(exclusive_vertices))
        G.set_graph_property(self, "conflicts", conflicts)

        return conflicts
示例#2
0
文件: g2_graph.py 项目: nilsec/mtrack
    def add_sum_constraint(self, vertices_left, vertices_right):
        """
        Require that the number of selected G2 nodes centered
        around a G1 node u is equal to the left and right
        of u. Ensures that we do not get branching.
        """
        assert (type(vertices_left) == list)
        assert (type(vertices_right) == list)

        for u in vertices_left + vertices_right:
            self.__check_id(u)

        sum_constraints = G.get_graph_property(self, "sum_constraints")
        sum_constraints.append(tuple([vertices_left, vertices_right]))
        G.set_graph_property(self, "sum_constraints", sum_constraints)
示例#3
0
文件: g2_graph.py 项目: nilsec/mtrack
 def get_sum_constraints(self):
     return G.get_graph_property(self, "sum_constraints")
示例#4
0
文件: g2_graph.py 项目: nilsec/mtrack
 def get_conflicts(self):
     return G.get_graph_property(self, "conflicts")
示例#5
0
文件: g2_graph.py 项目: nilsec/mtrack
 def get_must_pick_one(self):
     return G.get_graph_property(self, "must_pick_one")
示例#6
0
文件: g2_graph.py 项目: nilsec/mtrack
 def add_must_pick_one(self, g2_vertex_list):
     must_pick_one = G.get_graph_property(self, "must_pick_one")
     must_pick_one.append(tuple(g2_vertex_list))
     G.set_graph_property(self, "must_pick_one", must_pick_one)