Ejemplo n.º 1
0
    def __init__(self, N, G_in=None, init_empty=False):
        G.__init__(self, N, G_in=G_in)
        self.hash_value = None

        if not init_empty:
            if G_in is None:
                G.new_vertex_property(self,
                                      "orientation",
                                      dtype="vector<double>")
                G.new_vertex_property(self, "position", dtype="vector<double>")
                G.new_vertex_property(self, "partner", dtype="long long")

                G.new_vertex_property(self,
                                      "selected",
                                      dtype="bool",
                                      value=False)
                G.new_vertex_property(self,
                                      "solved",
                                      dtype="bool",
                                      value=False)
                G.new_edge_property(self,
                                    "selected",
                                    dtype="bool",
                                    value=False)
                G.new_edge_property(self, "solved", dtype="bool", value=False)
                G.new_edge_property(self,
                                    "edge_cost",
                                    dtype="double",
                                    value=0.0)

                for v in G.get_vertex_iterator(self):
                    self.set_partner(v, -1)

        # NOTE: Start/End dummy node and edge are implicit
        self.edge_index_map = G.get_edge_index_map(self)
Ejemplo n.º 2
0
    def __init__(self, N):
        G.__init__(self, N)

        # Initialized with 0.0, see graph.G and tests
        G.new_vertex_property(self, "costs", dtype="double")

        G.new_graph_property(self, "conflicts", dtype="python::object")
        G.set_graph_property(self, "conflicts", set())

        G.new_graph_property(self, "sum_constraints", dtype="python::object")
        G.set_graph_property(self, "sum_constraints", list())

        G.new_vertex_property(self, "forced", dtype="bool", value=False)
        G.new_vertex_property(self, "solved", dtype="bool", value=False)

        G.new_graph_property(self, "must_pick_one", dtype="python::object")
        G.set_graph_property(self, "must_pick_one", list())