The thing is I have to find all paths whith the smallest weight and max depth could be 6 (5 vertices could be in the middle). Between two vertices can be more relations with different weight. 

For example Path:

`weight(ABEF) = 2+3+1 = 6` or `2+2+1 = 5` if we choose different relations weight between nodes B and E.

And the same for other roads - there can be different weight between the same nodes because of different relations.

The database is huge and calculating all possibilities in depth 6 is looong time :/

How can I check once all relations weight between two nodes and in the same search not check those with largest weight and if there are relations with the same smallest weight, then take them both?

So far I have:

```
START n=node(158371), m=node(183090)
MATCH p=n-[r*..4]-m
WITH p, length(p) as len,r
RETURN  reduce(res=0, x in r: res + x.weight) as totalscore, len
ORDER BY totalscore desc;

```

but the database breaks if I search in depth 6 and find all possibilities. And reduce function acts like collecting strings but I need to count weight. (`2+3+1=6 not 2+3+1=231`)

P.s. If the graphical image is not visible, it's here: <http://postimg.org/image/bf9rfdtf7/>