def generate_state_space(data):
 state_space = defaultdict(list)
 for (state_a, state_b, cost) in data:
  state_space[state_a].append((state_b, cost))
  state_space[state_b].append((state_a, cost))
 return state_space

def generate_state_space ( data ) : state_space = defaultdict ( list ) for ( state_a , state_b , cost ) in data : state_space [ state_a ] . append ( ( state_b , cost ) ) state_space [ state_b ] . append ( ( state_a , cost ) ) return state_space
generate our state space graph given a set of possible actions: data = [ .