Density function for a directed graph by default.

Extended the function to give density for a directed graph (since the library usually creates directed graphs). If specifically needed the a true value can be passed to the function which will return the value for an undirected graph.