def substituteStates(q, state, aList): for i in range(len(aList)): if aList[i][0] == state: aList[i] = (q, aList[i][1]) aList.sort() Utilities.removeDuplicates(aList) return aList
def substituteState(betterState, worseState, automaton, transposedGraph): for pred in transposedGraph[worseState]: #if automaton.transitionRelation.has_key(pred): # Häh? if not automaton.transitionRelation[pred].has_key(betterState): automaton.transitionRelation[pred][betterState] = [] if not transposedGraph.has_key(betterState): transposedGraph[betterState] = [pred] else: transposedGraph[betterState].append(pred) automaton.transitionRelation[pred][betterState] += \ automaton.transitionRelation[pred][worseState] automaton.transitionRelation[pred][betterState].sort() Utilities.removeDuplicates(automaton.transitionRelation[pred][betterState]) ##if worseState in automaton.transitionRelation[pred][betterState]: ## automaton.transitionRelation[pred][betterState].remove(worseState) #else: # print "AND WHY NOT HERE?:", pred if worseState == automaton.initialState: automaton.initialState = betterState deleteState(worseState, automaton, transposedGraph)