Returning Graph with Relationship Stats as Properties

Hi All,

MATCH (a:Application)-[r]-(b) 
WHERE'MyApplication' AND type(r) in ['EXPORTS_DATA','IMPORTS_DATA']
WITH startNode(r) as sNode, endNode(r) as eNode, type(r) AS relType, COUNT(r) AS relCount 
RETURN sNode, eNode, apoc.create.vRelationship(sNode, relType, { type: relType, count: relCount }, eNode) as vRel 

Returns a beautiful graph summarizing all export & import interfaces for 'MyApplication'.
We need to use start/endNode(r) because 'MyApplication' may sometimes be the start node and end node at other times and is the only way I know of constructing the apoc.create.vRelatioship correctly.

However I am required to return sNode and eNode with their own count of all relatioships into + out of that respective node along with their existing properties.

The goal is to somehow combine the following statements into the above working cypher:

WITH startNode(r) as sNode, count(r) as sRelCount //total in+out rel count for sNode
WITH endNode(r) as eNode, count(r) as eRelCount //total in+out rel count for eNode
RETURN sNode{., rCount:sRelCount}, eNode{.,rCount:eRelCount}, apoc.create.vRelationship(sNode, relType, { type: relType, count: relCount }, eNode) as vRel

Which does create another problem because sNode{..}, eNode{..} are map projections but need returned as nodes so that graph engine can display RETURN >> as graph.

MH's response to this post - how-to-show-aggregate-info-in-graph , comes close but above requirements complicate it more. About a week now almost puking several times searching/trying so any help is appreciated.

In case you are interested, the reason I need total relationship counts per node (based on query conditions) is to display relative size, i.e node with rCount of 50 will appear twice as large as node with rCount of 25. This is passed to a size configuration setting in Neovis.js/Vis.js which then do all the rendering magic.

Thank you so much for your time.