(self, i, **attr)
| 42 | return i >= 0 and i < self.n |
| 43 | |
| 44 | def add_node(self, i, **attr): |
| 45 | if i >= self.n: |
| 46 | raise CompilerError('Cannot add node %d to graph of size %d' % (i, self.n)) |
| 47 | node = self.nodes[i] |
| 48 | |
| 49 | for a,value in list(attr.items()): |
| 50 | if a in self.default_attributes: |
| 51 | node[self.attribute_pos[a]] = value |
| 52 | else: |
| 53 | raise CompilerError('Invalid attribute %s for graph node' % a) |
| 54 | |
| 55 | def set_attr(self, i, attr, value): |
| 56 | if attr in self.default_attributes: |
no test coverage detected