sambayless / monosat

MonoSAT - An SMT solver for Monotonic Theories
MIT License
106 stars 29 forks source link

Bug in addNode() #30

Closed jo285317 closed 2 years ago

jo285317 commented 3 years ago

When a new node is added, there is a check for whether that name is already assigned to a node. However, this is done against the keys of self.names instead of the values.

  def addNode(self, name=None):
        ...
        if name is None:
            name = str(n)
        else:
            name = str(name)

        if name is not None and name in self.names:  <-----------
            raise ValueError("Node %s already exists" % (str(name)))

        self.names[n] = name
        self.nodemap[name] = n
        self.out_edge_map.append(dict())
        self.in_edge_map.append(dict())

        return n
jo285317 commented 3 years ago

31

sambayless commented 3 years ago

Thanks for the bug report, and thanks for pointing to the buggy code specifically, much appreciated!

sambayless commented 2 years ago

Closing this as resolved