On Path Homology of Vertex Colored (Di)Graphs

Abstract: In this paper, we construct the colored-path homology theory in the category of vertex colored (di)graphs and describe its basic properties. Our construction is based on the path homology theory of digraphs that was introduced in the papers of Grigoryan, Muranov, and Shing-Tung Yau and stems from the notion of the path complex. Any graph naturally gives rise to a path complex in which for a given set of vertices, paths go along the edges of the graph. We define path complexes of vertex colored (di)graphs using the natural restrictions that are given by coloring. Thus, we obtain a new collection of colored-path homology theories. We introduce the notion of colored homotopy and prove functoriality as well as homotopy invariance of homology groups. For any colored digraph, we construct the spectral sequence of colored-path homology groups which gives the effective method of computations in the general case since any (di)graph can be equipped with various colorings. We provide a lot of examples to illustrate our results as well as methods of computations. We introduce the notion of homotopy and prove functoriality and homotopy invariance of introduced vertexed colored-path homology groups. For any colored digraph, we construct the spectral sequence of path homology groups which gives the effective method of computations in the constructed theory. We provide a lot of examples to illustrate obtained results as well as methods of computations.

We construct the collection of path homology theories for vertex colored digraphs. Then we describe the possibility of implementing this theory to the case of edge colored digraphs and non-directed graphs. We will consider vertex colored (di)graphs which from now on will be simply called colored (di)graphs unless otherwise clearly stated.
The consideration of digraphs in this theory stems from the following reasons. The path homology theory is a natural generalization of simplicial homology theory and is defined for any path complex. Any digraph naturally gives rise to a path complex in which allowed paths go along directed edges. The path homology theory for digraphs provides the path homology theory for (non-directed) graphs by applying the functorial transformation from a given graph to the corresponding symmetric digraph [2].
In the classical algebraic topology, in most cases, the homology groups have a natural filtration that is given by the n-skeleton of CW or a simplicial complex. In the general case, the path homology groups do not have any structure that is similar to the n-skeleton. It follows directly from the results below that a vertex coloring of a digraph gives a functorial filtration that agrees with path homology groups. If we color a digraph in some way, then by the means of the spectral sequence constructed below, we obtain an effective method of computing the path homology groups of such a (di)graph.
Note also that the line digraph of an edge colored digraph gives the vertex colored digraph and that means in turn that the vertex colored homology theory might be applied to the edge colored digraphs and non-directed graphs. Let us mention here that the application of the colored homology theory to the case of quivers requires significant modifications. This fact follows from the generalization of the path homology theory to the category of quivers constructed in [4].
In our paper, we use the notions of the category and the functor (see, for example, ( [10,12], Chapter 1) and ( [13], Chapter 1)). A category C consists of a class of objects and for each ordered pair of objects (A, B) a collection of morphisms Hom (A, B). Any such morphism f ∈ Hom(A, B) will be denoted by f : A → B. For every pair of morphisms f ∈ Hom(A, B), g ∈ Hom(B, C), we define a composition g f = g • f ∈ Hom(A, C). The morphisms satisfy the following axioms. Let C and D be two categories. A functor F from C to D assigns to any object of C an object F (C) and to any morphism f ∈ Hom(A, B) of C a morphism F ( f ) ∈ Hom(F (A), F (B)) in such a way that It is necessary to remark that the notion of homotopy in the graph theory differs from a similar notion in the continuous topology (see Definition 4 and Example 1 below). Two digraph mappings f , g : G → H are homotopic if we can construct a sequence of digraph mappings f = f 0 , f 1 , . . . , f n = g from G to H, so that any pair of sequential mappings ( f i , f i+1 ) satisfies one of the following properties (see ( [2], §3.1)): Let us point out here the main new results provided in our paper. First, we introduce the category of colored digraphs and define a notion of the colored homotopy between colored morphisms. Then we describe the basic properties of the colored homotopy and colored morphisms and construct a collection of functorial path homology theories for colored digraphs. We prove the invariance of the colored-path homology groups relative to the colored homotopy. For any colored digraph we construct the spectral sequence of colored-path homology groups which gives the effective method of computations of path homology groups of arbitrary digraphs since any (di)graph can be equipped with various colorings. We also describe the transfer of the colored-path homology theory to the category of graphs and edge colored (di)graphs.
The paper is organized as follows. In Section 2, for the sake of convenience, we recall the basic definitions from the graph theory and the path homology theory for digraphs.
In Section 3, we bring the notion of colored digraphs to your attention and introduce the notion of homotopy for colored digraphs.
In Section 4, we define several path homology theories for the categories that were introduced in the previous Section. Next, we provide examples to illustrate the difference between the path homology theory of digraphs in colored and uncolored case.
In Section 5, we construct a spectral sequence for path homology groups of a colored digraph, and describe its basic properties. We also obtain a braid of exact sequences of path homology groups for 3-colored digraphs. We give detailed computations of path homology groups in such a braid of exact sequences for a digraph G that is the one-dimensional skeleton of the minimal triangulation of the closed Möbius band.
In Section 6, we describe applications of the obtained results to the case of non-directed graphs. We also explain the possibility of applying homology of vertex colored digraph to the edge colored digraphs and edge colored graphs using the line digraphs.
Finally, in Section 7, we give conclusions and make some remarks about our results, whereas is acknowledgement section.
For such a pair the vertex v is called an origin of the arrow and is denoted orig (v → w) while the vertex w is called an end of the arrow and is denoted end(v → w).

Definition 2.
A digraph mapping f : G → H (or simply a mapping) from a digraph G to a digraph H is a mapping f | V G : For a digraph G we denote by Id G : G → G the identity mapping that is the identity mapping on the set of vertices and the set of edges.
It is clear that digraphs with the digraph mappings form a category which throughout this paper will be denoted by D. Please note that digraphs together with non-degenerated mappings form a subcategory N of the category D.
is a digraph with a set of vertices V Π = V G × V H and a set of arrows E Π given in the following way. For two vertices x, x ∈ V G , and two vertices y, y ∈ V H there is an arrow (x, y) → (x , y ) ∈ E Π if and only if either x = x and y → y , or x → x and y = y .
In Example 1 below we give a graph interpretation of the Box product. Fix n ≥ 0. Denote by I n = (V I n , E I n ) a digraph for which V I n = {0, 1, . . . , n} and, for i = 0, 1, . . . n − 1, there is exactly one arrow i → i + 1 or i + 1 → i without any other available arrows. We will refer from now on to I n as a segment digraph. Let us note here that the notion of a segment digraph coincides with the notion of a line digraph introduced in papers [1][2][3][4][5][6]. We are forced to use different terminology because the standard notion of a line digraph already exists in the graph theory and will also be used later in this paper.

Definition 4.
Two digraph mappings f 0 , f 1 : G → H are called homotopic if there exists a segment digraph I n ∈ I (n ≥ 0) and a digraph mapping F : G I n → H called a homotopy between f 0 and f 1 , such that In such a case we write f 0 f 1 .
Example 1. Now we give several digraphs to illustrate definitions introduced above.
(i) For the digraph G = (V G , E G ) presented on the diagram below (ii) Let G be a digraph given in (1) and H = (V H , E H ) be a digraph provided below Then the mapping f is the digraph mapping but it is not a non-degenerate digraph mapping since f (c → b) is not an arrow. Let g : V G → V H be the mapping given by f (a) Then the mapping g is the non-degenerate digraph mapping. (iii) The explanation of the Box product is given in the diagram below: and H = I 1 be the line digraph 0 → 1. Let f : G → H be the mapping given on the set of vertices f (a) = f (c) = 0, f (d) = f (b) = 1 and g : G → H be the mapping given on the set of vertices g(a) = g(b) = 0, g(c) = g(d) = 1. Let I be the segment digraph 0 → 1 ← 2. Now we define the homotopy F : G I → H between f and g as follows: In the Figure 1 given below we point out the images of the vertices of the digraph G I under the homotopy mapping F.

The relation
is an equivalence relation on the set of digraph mappings from G to H. Two digraphs G and H are homotopy equivalent if there exist digraph mappings f : G → H and g : H → G such that f • g Id H and g • f Id G , where Id H and Id G are the identity mappings of H and G respectively. In this case, we write H G and call the mappings f and g homotopy inverses to each other. Thus, the category D with the same objects as in D and with the morphisms given by classes of homotopy equivalent digraphs mappings is defined.
A homotopy F is non-degenerate if it is non-degenerate as a digraph mapping. We define a category N with the same objects as in N and with the morphisms that are given by classes of homotopies by means of the non-degenerate homotopy of non-degenerate mappings. Now we define the path homology groups of a digraph G = (V, E). For p ≥ 0, we define an elementary p-path on a set V as a sequence i 0 , ..., i p of p + 1 of vertices (not necessarily different) and denote this path e i 0 ...i p . Let R be a commutative ring with a unity 1 ∈ R and let Λ p = Λ p (V, R) be a free R-module generated by all elementary p-paths e i 0 ...i p . The elements of Λ p are called p-paths. Set Λ −1 = 0 and for p ≥ 1, define the boundary operator ∂ : Λ p+1 → Λ p on basic elements by where i q means omitting the corresponding index. We assume that ∂ : It is easy to check that for any elementary p-path v, we have ∂ 2 v = 0, hence the homomorphism Any 0-path is regular. For p ≥ 0, we denote by I p a submodule of Λ p that is generated by all irregular elementary paths. In particular, I 0 = 0 and we set I −1 = 0. It is easy to check that ∂(I p+1 ) ⊂ I p for p ≥ −1. Thus, we obtain a chain complex We note here that thus obtained path complex is defined for arbitrary discrete set V but basic elements e i 0 ...i p ∈ R p (i k ∈ V) depend on the order of the vertices i 1 , . . . , i p in the recording e i 0 ...i p . For example, for V = {i, j, k} the elements e ijk and e jik are different. The differential ∂ is well defined for basic elements and, for example ∂(e ijk ) = e jk − e ik + e ij . Now we consider a digraph G = (V, E). Let e i 0 ...i p be a regular elementary p-path on the set of vertices V. For p ≥ 1, it is called allowed if (i k−1 → i k ) ∈ E for any k = 1, . . . , p, and non-allowed otherwise. For p = 0 any elementary path is regular. For p ≥ 0, denote by A p = A p (G, R) a submodule of R p (V, R) that is generated by the allowed elementary p-paths and set A −1 = 0. The elements of the modules A p are called allowed p-paths. Now we define the path homologies of a digraph G = (V, E). Consider the following submodule of A p , namely The elements of Ω p are called ∂-invariant p-paths. Examine now the chain complex Its homologies are called path homologies of the digraph G with the coefficients in the ring R and are denoted by Every elementary allowed path e i 0 ...i p ∈ Ω p (G) of the chain complex (6) has a naturally ordered structure on the set of vertices i 1 , . . . , i p that is defined by arrows of the digraph. By definition, each pair i k , i k+1 ∈ V G of neighboring vertices in e i 0 ...i p must give an arrow (i k → i k+1 ) ∈ E G . The differential ∂ in the chain complex Ω * is well defined and preserves this ordering.
The path homology groups give a collection of (di)graphs invariants and provide deep connections of the graph theory to discrete geometry, algebraic topology, and mathematical physics (see, for example [1,6,[14][15][16][17]). For the sake of convenience, we formulate the basic result of the categorical properties of path homology groups which will be used throughout this paper.

Categories of Colored Digraphs
In the first part of this section we recall the basic definitions concerning digraph coloring (see [7][8][9][10][11]). Then we describe several categories of colored digraphs that fit the path homology theory defined in Section 2.

Definition 5.
A coloring of a digraph G = (V G , E G ) is given by an assignment of a color to each vertex v ∈ V G . A coloring that uses k colors is called k-coloring.

Recall that two vertices
the open neighborhood of any vertex v contains at most k-vertices with the same color as v. As usual, we can consider a coloring as a function ϕ : V G → N. In the case of k-coloring, we assume that ϕ : V G → {1, 2, . . . , k}. We shall write (G, ϕ) for a digraph G with a coloring function ϕ.
It is clear that colored digraphs with the morphisms defined above form a category which from now on will be denoted by C. This category has the naturally defined subcategory C 0 , objects of which are given by proper colored digraphs and morphisms are given by non-degenerate mappings that satisfy Definition 6. Moreover, if we let C k (k ≥ 1) be the subcategory of C with the objects that are given by k-improper colored digraphs and with morphisms that are given by digraph mappings that satisfy Definition 6, then we obtain a filtration of the category C. In what follows, we will consider a proper coloring as the k-improper coloring with k = 0. For a colored digraph (G, ϕ), we can consider only the digraph G that now is recognized as one without any coloring. Any morphism of colored digraphs f : (G, ϕ) → (H, ψ) is, in particular, a digraph mapping f : G → H. Thus, we obtain a forgetful functor from the category of colored digraphs to the category of digraphs.
For any colored digraph (G, ϕ) and a segment digraph I n , we define a coloring Φ on the digraph For a k-improper colored digraph (G, ϕ), the coloring Φ gives a (k + 1)-improper coloring of the digraph G I n . We shall say that two morphisms f 0 , We will denote this relation exactly as before, namely , since the category under investigation will be clear from the given context.

Proposition 1.
The relation "to be colored homotopic" is an equivalence relation on the set of colored morphisms f : (G, ϕ) → (H, ψ) and provides a relation of colored homotopy equivalence of colored digraphs.

Proof. Consider the set of colored morphisms
f . The proof of the remaining properties follows from corresponding results for digraph mappings.
Thus, we obtain the colored homotopy category C in which the objects are colored digraphs and morphisms are classes of colored homotopic morphisms. Proof. The statement (i) is known and results directly from Definitions 2 and 6. To prove (ii), we must check only that the colored homotopic mappings f 0 f 1 coincide. Consider the case I n = I 1 = (0 → 1) and let F : Performing induction by n and using the same line of arguments finishes the proof. Now we give several examples that explain that the introduced notions are non-degenerate.
Let f 0 : G → G be the identity mapping and f 1 : G → G be the mapping defined on the set of vertices in the following way f (a) = a, f (b) = f (c) = b. Observe that thus defined, f 0 and f 1 are colored morphisms. Define the colored homotopy F : G I 1 → G on the set of vertices by Then it follows that f 0 is colored homotopic to f 1 . (ii) Let G be the proper colored digraph presented on (11) By Proposition 2, any two different colored morphisms f 0 , f 1 : G → G are not colored homotopic. By ([2], Ex. 3.12) digraph G is contractible and, hence, any two digraph mappings to G are homotopic. It is a relatively easy exercise to construct directly a homotopy between the identity mapping f 0 and the mapping f 1 that is given on the set of vertices by

Path Homology of Colored Digraphs
Now we turn our attention to defining several path homology theories for colored digraphs and describe relations between them. We will provide examples that illustrate the difference between the path homology theory of digraphs in cases of colored and uncolored ones.
Let G = (V, E) be a colored digraph with a given coloring ϕ : V → N. Fix a natural number k ≥ 1.

Definition 7.
An elementary path e i 0 ...i p (p ≥ 0) on the set V of vertices is called k-colored if vertices of this path are colored with k-colors.

Example 3.
Consider the colored digraph in Figure 2. The path e 013 is 2-colored while the path e 046 is 3-colored. Please note that any regular elementary p-paths are k-colored where k ≤ p + 1.
For p ≥ 0, let A k p = A k p (G, R) = A k p (G, ϕ) be a free R-module generated by all allowed regular elementary p-paths, which are colored by s colors, 1 ≤ s ≤ k. Let A k −1 = 0. We have the following natural inclusions of the modules Now we define k-colored-path homologies of the colored digraph (G, ϕ). Let be a submodule of A k p . The elements of Ω k p are called ∂-invariant k-colored paths. Similarly, to the case of path homology, we obtain that ∂(Ω k p ) ⊂ Ω k p−1 . As a result, we have the following chain complex with the differential that is induced from the differential in R * . Homology groups of the chain complex (14) are called k-colored path homology groups of a digraph (G, ϕ) and are denoted by H k p (G, R).

Example 4. Consider the proper colored digraph cube in
To simplify computations, we assume that R = R. It arises from [2] that H 0 (G) = R and H n (G) = 0 for n ≥ 1.
The module Ω 1 0 (G) is generated by elements e n , where n ∈ V G and, hence rang Ω 1 0 (G) = 8. The modules Ω 1 k (G) are trivial since G is proper colored. It follows that H 1 n (G) = R 8 for n = 0, 0 for n ≥ 1.
The module A 2 3 (G) is generated by the elements {e 0237 , e 0457 } and Ω 2 3 (G) = 0, since ∂e 0237 / ∈ A 2 2 , ∂e 0457 / ∈ A 2 2 . The modules Ω 2 n (G) are trivial for n ≥ 3 because there are no paths of the length greater than 3 in G. For more clarity, let us write all the considerations above in the more approachable form, namely 12 for n = 1, 4 for n = 2, 0 for n ≥ 3.
Calculating directly, we provide the following result Recall that by ([2], 2.5, and Th. 2.10), any digraph mapping f : G → H defines a morphism of chain complexes f * : Ω * (G) → Ω * (H) (16) which on the basic elements of the module A p (G, R) is given by Theorem 2. Let f : (G, ϕ) → (H, ψ) be a morphism of colored digraphs. For k ≥ 1, the morphism f * in (16) provides a morphism of chain complexes and, hence, an induced homomorphism of k-colored homology groups
Now we prove the colored homotopy invariance of colored homology groups of digraphs. of colored homology groups for k ≥ 1.

Proof.
It is sufficient to prove the statement for a homotopy in the case I n = I 1 = (0 → 1). The general case follows by induction. By Theorem 2, the colored morphisms f i (i = 0, 1) and F induce morphisms of chain complexes Please note that we can identify colored digraphs G {0} and G {1} with the colored digraph G in a natural way. We will denote vertices (i, 0) ∈ V G {0} by i and vertices (i, 1) ∈ V G {1} by i . Similar notations will be used for arrows and paths. By the definition of the colored homotopy, for any colored on elementary paths in the following way By ( [2], Pr. 2.12 and §3.2) L p are well defined colored mappings and the condition is satisfied. Thus, we have a chain homotopy between the morphisms f i * and the statement of the Theorem follows from ( [13], Theorem 2.1).

Corollary 1.
If the colored digraphs (G, ϕ) and (H, ψ) are colored homotopy equivalent, then the colored homology groups H k * (G, R) and H k * (H, R) are isomorphic for k ≥ 1 and mutually inverse isomorphisms of these groups are induced by the homotopy inverse colored morphisms.

Corollary 2.
For k ≥ 0, the colored homology groups H k * (·, R) provide a functor from the colored homotopy category C to the category R-modules and homomorphisms.

Spectral Sequence for Path Homology Groups of a Colored Digraph
In this section, we construct a spectral sequence for path homology groups of any colored digraph. Our construction is based on the concept of an exact couple of a filtered chain complex from ( [18], Chapter 7).
Let (G, ϕ) be a vertex colored digraph. By Proposition 3 we have a filtration (15) of the chain complex Ω * (G, R). Let K * = Ω * (G, R). We define a filtration of K * by subcomplexes K p * for p ∈ Z in the following way Thus, we have an infinite filtration Theorem 4. The filtration (22) has the following properties.

2.
There is a short exact sequence of chain complexes Proof. The first statement follows from the definition (21). The elements of the module K p * K p−1 * are given by linear combinations of allowed paths which are colored exactly by p + 1 colors. Any elementary allowed path e i 0 ...i s can be colored at most by s + 1 colors. Hence, for s + 1 < p + 1 (that is for s < p) the module K Now we describe the spectral sequence of the filtration (22) following [18] (Chapter 7). Let and D * = {D p,q }, E * = {E p,q } be corresponding bigraded R-modules. Consider the homomorphisms of homology groups that follow from exact sequences of the Corollary 3 for various p and n = p + q: The homomorphisms in (25) define bigraded homomorphisms of bidegree (+1, −1), (0, 0), and (−1, 0) respectively.

Proposition 4.
The bigraded modules D * , E * and the homomorphisms i * , j * , k * fit into the commutative diagram which is exact in each vertex. Thus, we have an exact couple of modules in the sense of [18].
Proof. The proof in the general case of a chain complex with filtration is given in ( [18], Chapter 7).

Corollary 4.
The exact couple in (27) defines a spectral sequence with the first differential d 1 = {d p,q } where d p,q : E 1 p,q → E 1 p−1,q is given by The group E r p,q is isomorphic to the quotient group The differential d r+1 coincides with the composition j * (i * ) −r k * .
Proof. The proof for the general case of an exact couple for a chain complex with filtration is given in ( [18], Chapter 7).
We shall call this spectral sequence a vertex colored spectral sequence of path homology groups of a colored digraph (G, ϕ). The general properties of the spectral sequence are described in [18]. We recall now the basic definitions and properties in our case.
We put F p,q = Im H p+q (K p * ) → H p+q (K * ) . We have a natural inclusion F p−1,q+1 → F p,q , and hence, we can define a module Theorem 5. The vertex colored spectral sequence of a colored digraph (G, ϕ) converges, that is (i) E r p,q = E r+1 p,q for r > max p, q + 1, Proof. The proof follows from Theorem 4 and [18] (Chapter 7: Proposition 5, Theorem 1).
Theorem 6. Let (G, ϕ) be a 3-colored digraph. Then the filtration in (22) gives a finite filtration Moreover, the vertex colored spectral sequence gives a commutative braid of the exact sequence which consists of the following exact sequences Proof. The inclusions of chain complexes in (29) follow directly from (22). By ( [19], Chapter 4), these inclusions induce a short exact sequence and, hence, the commutative diagram of chain complexes in which the rows and columns are short exact sequences. The homology long exact sequences of the short exact sequences from (30) give the commutative braid of exact sequences.
We have rang Image{∂ : K 1 1 → K 0 1 } = 4 since G is a connected digraph (see [2]). The differential ∂ : K 1 3 → K 1 2 is a monomorphism. Consider the differential ∂ : K 1 2 → K 1 1 . It is easy to see that elements ∂e 014 and ∂e 023 are independent and they are independent of the image of the restriction of ∂ to a submodule M of K 1 2 generated by e 123 , e 124 , e 134 , e 234 . Now we directly check that Thus, Hence, (32) Now we compute the homology groups of the chain complex It follows from the calculations above that K 1/0 0 = 0, (33) Now we compute the homology groups of the chain complexes K 2/1 * : = K 2 * K 1 * and K 2/0 * : = K 2 * K 0 * .
First, we describe modules of the chain complex K 2 * = Ω * . As with the notions above, we have and K 2 n = 0 for n ≥ 5. Using these results, we get the following Now we turn our attention to the homology groups of the chain complex Having in mind modules of the chain complexes K 2 * and K 0 * , by calculating directly, we obtain the following Keeping that in mind, we obtain the following results (38) Now we can write down the braid of exact sequences for the filtration in (29) and using the diagram chasing, we compute the groups H * (K * ) and homomorphisms in this diagram. We obtain the following commutative braid of exact sequences: in which we wrote in a bold font all the groups that were provided by diagram chasing.

Proposition 5.
The spectral sequence constructed in Theorem 6 is functorial, which means that any morphism of colored digraphs induces a morphism of corresponding spectral sequences.

Path Homology of Colored Graphs
In this section, we apply the results obtained so far to the category of non-directed colored graphs. To do this, we need to use the isomorphism between the category of graphs and the full subcategory of symmetric digraphs. To avoid further misunderstandings in this section, we denote undirected graph and graph mapping with a bold font and continue to use the same notations for digraphs as before.

Definition 8.
(i) A graph G is given by a set V G of vertices and a subset E G ⊂ V G × V G of non-ordered pairs of vertices (v, w) with v = w that are called edges. (ii) A mapping f : G → H is a mapping f : V G → V H such that for any edge (v, w) ∈ E G we have either The set of all graphs with graph mappings forms a category G. We can associate each graph Thus, we obtain a functor O that provides an isomorphism of the category G and the full subcategory of symmetric digraphs of the category D.

Definition 9.
(i) A coloring of a graph G = (V G , E G ) is given by an assignment of a color to each vertex v ∈ V G .
A coloring that uses k colors is called k-coloring. We denote by (G, ϕ) a graph G with a coloring function ϕ : V G → N. The colored graphs with the defined above morphisms form a category which we denote CG. For any colored graph (G, ϕ), we define a colored digraph O(G, ϕ) = (G, ϕ) by setting G = O(G) and attaching the same coloring map ϕ on the set of vertices V G = V G . Now we have the following result. The Box product G H of two graphs G = (V G , E G ) and H = (V H E H ) is defined similarly to the Box product of digraphs. We put V G H = V G × V H and [(x, y), (x , y )] ∈ E G H if and only if either x = x and y ∼ y , or x ∼ x and y = y where x, x ∈ V G , y, y ∈ V H . Please note that the functor O preserves Box products (see [2], Lemma 6.3), that is O(G H) = G H.
We introduce now the notion of segment graph which is equivalent to the notion of the line graph in [2] since we shall use the classical notion of a line graph below. A segment graph J n = (V, E) of the length n ≥ 0 is defined as follows: V = {0, 1, . . . , n} and E = {(k, k + 1)|0 ≤ k ≤ n − 1}. In this case, we shall write f g. Now the homotopy equivalence of graphs is defined in a natural way. Remark 1. The relation " " is an equivalence relation on the set of graph mappings and it induces the notion of homotopy equivalence on the set of graphs. The functor O preserves the relation of homotopy equivalence (see [2]), that is two graph mappings f, g : G → H are homotopic if and only if the digraph mappings f = O(f) and g = O(g) are homotopic.
We define the k-colored homology groups H k * (G, R) of a colored graph (G, ϕ) in the following way Example 6. Consider the 3-proper colored graph G in Figure 4 which has 7 vertices and 9 edges. We now compute now the homology groups H 2 1 (G, R) and H 3 1 (G, R) for R = R.  We compute ranks of the kernels and the images of the differential directly. These calculations lead us to homology groups H 2 1 (G, R) = R and H 3 1 (G, R) = 0.
Equation (39), Remark 1, and the results of Section 5 together give the following result.
Theorem 7. For any n ∈ N, the k-colored homology groups H k n (·, R) provide the homotopy invariant functors from the category CG to the category of R-modules. Moreover, all algebraic results of Section 5 can be transferred to the category of colored graphs. Now we describe an application of the above developed methods for constructing a path homology theory for edge colored (di)graphs. At first, we recall several standard definitions. Definition 11. An edge coloring of a digraph G = (V G , E G ) is given by an assignment of a color to each edge (v → w) ∈ E G . We can identify the colors with natural numbers and denote this digraph by (G, ϕ) where ϕ : E G → N is the coloring.
A morphism f : (G, ϕ) → (H, ψ) of edge colored digraphs is a non-degenerate digraph mapping f : G → H such that ψ • f (e) = ϕ(e) for all e ∈ E G .
Thus, we obtain a category CE in which objects are edge colored digraphs and morphisms are given by non-degenerate digraph mappings that commute with colorings. Definition 12. The line digraph of a digraph G = (V G , E G ) is the digraph L(G) = G * = (V * , G * ) obtained from G by associating with each edge e = (v → w) ∈ E G a vertex e * ∈ G * , and there is a directed edge e * 1 → e * 2 for e 1 = (v 1 → w 1 ), e 2 = (v 2 → w 2 ) ∈ E G if and only if w 1 = v 2 .
An edge coloring ϕ of a digraph G induces a vertex coloring Lϕ = ϕ * of the digraph G * = (V * , G * ) by the rule ϕ * (e * ) = ϕ(e) = ϕ(v → w) for e = (v → w) ∈ E G . The example of the application of the functor L is given in Figure 4. Directly from the definitions above we obtain the following result.
Theorem 8. The k-colored homology groups H k * (G, ϕ) of edge colored digraphs define a functor from the category CE to the category R-modules.
Proof. Follows from Theorem 2 and Lemma 1.

Example 7.
Consider the edge colored digraph G in Figure 5 with the set of edges E G = {0, 1, 2, 3, 4}. The vertex colored digraph LG is presented now in Figure 5. Let R = R. Now similarly to computing in Sections 4 and 5 we find