We construct a cohomology theory on a category of finite digraphs (directed graphs), which is based on the universal calculus on the algebra of functions on the
vertices of the digraph. We develop necessary algebraic technique and apply it for investigation of functorial properties of this theory. We introduce categories of digraphs
and (undirected) graphs, and using natural isomorphism between the introduced category of graphs and the full subcategory of symmetric digraphs we transfer our cohomology theory to the category of graphs. Then we prove homotopy invariance of the introduced cohomology theory for undirected graphs. Thus we answer the question
of Babson, Barcelo, Longueville, and Laubenbacher about existence of homotopy
invariant homology theory for graphs.