The structure of weaving