Re: Beginner question - sum multiple edges

2017-04-23 Thread Gábor Gévay
Hi Marc, You can do such a map on your edges dataset that switches the direction of edges if the source id is bigger than the target id. So your MapFunction will have an if, which checks whether the source id is bigger than the target id, and if it is bigger, than returns the edge reversed, else r

Re: Beginner question - sum multiple edges

2017-04-23 Thread Kaepke, Marc
Hi Gábor and anyone else ;-) , I need your help again. My goal is a graph without self-loops and sum all edge values between two vertices into one single edge (both direction). e.g. my input graph is described by: 1 2 10 1 2 10 2 1 10 1 1 1 1 3 5 The result has to be: 1 2 30 (sum and reduce all

Re: Beginner question - sum multiple edges

2017-04-17 Thread Kaepke, Marc
Hi Gábor, thanks a lot Best, Marc > Am 17.04.2017 um 20:32 schrieb Gábor Gévay : > > Hello Marc, > > You can group by edge, and then sum: > > edges > .groupBy(0,1) // make first two fields a composite key > .sum(2); // sum the value field > > This will turn multiple edges that have the sam

Re: Beginner question - sum multiple edges

2017-04-17 Thread Gábor Gévay
Hello Marc, You can group by edge, and then sum: edges .groupBy(0,1) // make first two fields a composite key .sum(2); // sum the value field This will turn multiple edges that have the same source and target into one edge, whose value will be the sum of the values of the original group of e

Beginner question - sum multiple edges

2017-04-17 Thread Kaepke, Marc
Hi, how can I sum and reduce multiple edges in my entire graph? e.g. my input graph looks like (source-ID, target-ID, value): (1, 2, 30) (1, 2, 10) (2, 1, 55) And I need: (1, 2, 40) (2, 1, 55) Thanks! Marc