Cohomology of digraphs and (undirected) graphs