Hi Vinayak,
May be try below.
g.V().has('property1', 'A').
outE().has('property1','E').
where(inV().has('property1', 'B')). fold().
project('edgeCount', 'vertexCount').
by(count(local)).
by(unfold().bothV().dedup().count()) // I do not think dedup is required for your use case, can try both with and without dedup
Regards, Amiya