graphx icon indicating copy to clipboard operation
graphx copied to clipboard

Edge contraction

Open jegonzal opened this issue 12 years ago • 1 comments

Based on our discussion today it seems like it might be helpful to have a function of the form:

def contractEdges(
  ePred: EdgeTriplet[VD,ED] => Boolean, 
  contractFun: EdgeTriplet[VD,ED] => VD,  
  mergeFun: (VD, VD) => VD): Graph[VD, ED]

where the user defined edge predicate ePred determines which edges to contract and the user defined contractFun renders a new vertex for the contracted edge and mergeFun merges multiple vertices that have been contracted together.

jegonzal avatar Oct 24 '13 22:10 jegonzal

This function is actually pretty challenging given that an invocation of:

g.contractEdges(x => true, _.srcAttr, (a,b) => a) 

computes connected components.

jegonzal avatar Oct 27 '13 18:10 jegonzal