Hi Hernan,

the only way I could do what you ask is as follows:
-> I created a JavaScript function from Visual Studio called getWeight with 
2 parameters: name1 and name2. 
This function returns the total weight of the edges crossed:

var listOfRid = [];
var rid = "";
var first = "";
var second = "";
var x = 0;
var j = 0;
var k = 0;
var weIn= "";
var weOut= "";
var tot=0;
var flag =0;

var g = orient.getGraph();
var di= g.command("sql","select expand(dijkstra) from (select 
dijkstra((select from City where name='"+name1+"'), (select from City where 
name='"+name2+"'),'weight' ))");

for (i=0; i<di.length; i++){
rid = di[i].getId().toString(); 
    listOfRid.push(rid);
}
var weight = g.command("sql","select from connect");
do{
  first = listOfRid[x];
  x++;
  second = listOfRid[x];
    do{
  weIn=weight[k].getProperty('in').getId().toString();
weOut=weight[k].getProperty('out').getId().toString();
  if ((first.equals(weOut)) && (second.equals(weIn))){
        tot+=parseFloat(weight[k].getProperty('weight'));
        flag=1;
  }
      k++;
  }while(k<weight.length && flag==0);
  j++;
  flag=0;
  k=0;
}while(x<listOfRid.length-1);

return tot;


-> After that, I used the following query from the browse:


select expand($c)
let $a = (select expand(dijkstra) from (select dijkstra( (select from City 
where name='A'), (select from City where name='H'), 'weight' ))),
$b = (select getWeight("A","H") as Total),
$c = unionAll($a,$b)


This return some like this:

<https://lh3.googleusercontent.com/-o2iQlQeZbNI/VdHmHQU234I/AAAAAAAAAH8/Y4j4OB5QYNY/s1600/Immagine.png>

I know that isn't exactly what you wanted, but I didn't find other options.


Regards,

Giulia



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to