basic PATH pat = (src)-...pattern..-(dst),... MATCH ... -/ pat* /- … ON g
This can be implemented as a rewrite:
MATCH … -/ pat*/- … ON (
CONSTRUCT g,(src)-[pat]-(dst)
MATCH (src)-..pattern…-(dst),.. )
Add weighted paths on PATH expressions by adding a ’weight’ property on the newly created edges. In the translation and specifically the generation of the graphX code, we need GraphX to sum the “weight” properties to calculate the path length (as opposed to taking hop-count). It is probably better not to expose this on the g-core syntax level, but put this as an annotation on the GraphX operator during the translation.
The rewrite for weighted PATH pat = (src)-...pattern..-(dst),...COST ..Y.. used in MATCH … -/ pat* COST x/- … is therefore:
MATCH … -/ pat* COST x/- … ON (
CONSTRUCT g,(src)-[pat {weight:=..Y..}]-(dst)
MATCH (src)-..pattern…-(dst),.. )
again, somehow we need to ensure that COST x now gets filled not with the hopcount, but with the SUM(weight). The GraphX implementation already has some support for this, but it needs to be triggered. This extra info is probably best a property attached to the algebra tree nodes, so the GraphX code generation can pick it up and generate the appropriate stuff
MATCH … -/ pat*/- … ON ( CONSTRUCT g,(src)-[pat]-(dst) MATCH (src)-..pattern…-(dst),.. )
The rewrite for weighted PATH pat = (src)-...pattern..-(dst),...COST ..Y.. used in MATCH … -/ pat* COST x/- … is therefore:
MATCH … -/ pat* COST x/- … ON ( CONSTRUCT g,(src)-[pat {weight:=..Y..}]-(dst) MATCH (src)-..pattern…-(dst),.. )
again, somehow we need to ensure that COST x now gets filled not with the hopcount, but with the SUM(weight). The GraphX implementation already has some support for this, but it needs to be triggered. This extra info is probably best a property attached to the algebra tree nodes, so the GraphX code generation can pick it up and generate the appropriate stuff