A Hebbian approach to complex-network generation