Structure and complexity in economic and social systems