Associative processors and directed graphs for optical processing