In this talk we show that network ensembles approximating real networks to the desired level of coarse graining can be constructed by statistical mechanics methods. These networks include networks with communities and networks embedded in a real space having an heterogeneous degree distribution. A interesting quantity that can be calculated is the entropy of these network ensembles. The entropy of network ensembles is able to quantify the level of order present in complex networks by statistical mechanics methods and has various theoretical implications. In particular we will show that scale-free networks have much smaller entropy than random graphs. This provides some fundamental argument in favor of the idea scale-free networks are a result of an non-equilibrium process.The entropy of random network ensemble can be also used for inference problems. In particular we will show how we can construct an entropy based indicator able to asses the relevance of features on a network.