Given R and S relations , the composition R o S is defined as :
R o S = { (x,z) | (x,y) ∈ S and (y,z) ∈ R }
So for the two directed graphs , we can write equivalent R and S relations whose pairs are the edges in R and S respectively..Having written the R and S relations , we can do the composition R o S as mentioned above and obtain the resultant graph.
This way composition of graphs is done.