Living in a group creates a complex and dynamic environment in which the behavior of the individual is influenced by and affects the behavior of others. Although social interactions and group living are fundamental adaptations exhibited by many organisms, relatively little is known about how prior social experience, internal states and group composition shape behavior in a group, and the neuronal and molecular mechanisms that mediate it. Here we present a practical framework for studying the interplay between social experience and group interaction in Drosophila melanogaster and show that the structure of social networks and group interactions are sensitive to group composition and individuals' social history. We simplified the complexity of interaction in a group using a series of experiments in which we controlled the social experience and motivational states of individuals to dissect patterns that represent distinct structures and behavioral responses of groups under different social conditions. Using high-resolution data capture, machine learning and graph theory, we analyzed 60 distinct behavioral and social network features, generating a comprehensive representation ("group signature") for each condition. We show that social enrichment promotes the formation of a distinct group structure that is characterized by high network modularity, high interindividual and inter-group variance, high inter-individual synchrony, and stable social clusters. Using environmental and genetic manipulations, we show that this structure requires visual and pheromonal cues. Particularly, the male specific pheromone cVA and Or65a sensory neurons are necessary for the expression of different aspects of social interaction in a group. Finally, we explored social interactions in heterogenous groups and identified clusters of features that are sensitive to increasing ratios of aggressive flies, some of which reveal that inter-individual synchronization depends on group composition. Our results demonstrate that fruit flies exhibit complex and dynamic social structures that are modulated by the experience and composition of different individuals within the group.This paves the path for using simple model organisms to dissect the neurobiology of behavior in complex environments associated with living in a group.Many species have adapted to living in groups, from simple organisms, such as nematodes, to humans. Group living takes different forms with various levels of complexity, from almost random interactions to fully synchronized collective behavior 1-5 , and can be described by measuring the behavior of individuals, the interaction between individuals and the resulting social network, altogether defined here as "group behavior". When individuals interact in a group, their internal motivational state, previous memories and other physiological processes affect their action selection, giving rise to diverse activity levels, behavioral responses, and engagement with others 6 . This results in a highly complex and continuously changing envi...