def count(graph,states):
    """Counts how many nodes have a state as in state. Returns a dictionary
    """
    count = {}
    for s in states:
        count[s] = 0
    for n in graph.nodes:
        count[graph.nodes[n]['state']] += 1
    return count