Update build_labeled_succ to include the case of rules without label
Showing
1 changed file
with
11 additions
and
2 deletions
... | @@ -189,11 +189,20 @@ def build_labeled_succ(v): | ... | @@ -189,11 +189,20 @@ def build_labeled_succ(v): |
189 | # v.g.m.transitions() returns a dict of {"R15" : shom} | 189 | # v.g.m.transitions() returns a dict of {"R15" : shom} |
190 | 190 | ||
191 | res = dict() | 191 | res = dict() |
192 | - labels = list(set([r.label for r in v.model.spec.rules]))# build a list of unique value of Rule labels | 192 | + labels = list(set([label for r in v.model.spec.rules if r.label for label in r.label.split(",")]))# build a list of unique value of Rule labels |
193 | labels.sort() # sort this list for better display | 193 | labels.sort() # sort this list for better display |
194 | + # rules without labels | ||
195 | + # get the indexes of the rules labeld with label | ||
196 | + rules_index = [r.name() for r in v.model.spec.rules if not r.label] | ||
197 | + # get the shoms corresponding to those indexes | ||
198 | + shoms = [v.g.m.transitions()[i] for i in rules_index] | ||
199 | + # build the union of those shoms | ||
200 | + succ = functools.reduce(shom.__or__, shoms, shom.empty()) | ||
201 | + res["None"] = succ | ||
202 | + # rules with labels | ||
194 | for label in labels: | 203 | for label in labels: |
195 | # get the indexes of the rules labeld with label | 204 | # get the indexes of the rules labeld with label |
196 | - rules_index = [r.name() for r in v.model.spec.rules if r.label == label] | 205 | + rules_index = [r.name() for r in v.model.spec.rules if r.label and label in r.label.split(",")] |
197 | # get the shoms corresponding to those indexes | 206 | # get the shoms corresponding to those indexes |
198 | shoms = [v.g.m.transitions()[i] for i in rules_index] | 207 | shoms = [v.g.m.transitions()[i] for i in rules_index] |
199 | # build the union of those shoms | 208 | # build the union of those shoms | ... | ... |
-
Please register or login to post a comment