jacomyal/sigma.js — pull request #316 by sheymann (2014-06-21 10:59:28+00:00)
Title: Edge quadtree integration, edge events, edge hovering

Let's interact with edges! They are no second-class citizen anymore. This code works with all edge types provided by default in sigma.js, and should be directly compatible with my plugin of 'tapered edges' as well.

### How it works
Edges are indexed in a quad tree. Indexing and querying this quad tree is deactivated when the ForceAtlas2 is running, on node drag, and on animation. The quad tree is updated at the end of these actions.

### New events
`overEdge`, `outEdge`, `clickEdge`, `overEdges`, `outEdges`, `clickEdges`

### New settings
- `enableEdgeHovering`
- `edgeHoverColor`
- `edgeHoverSizeRatio`
- `defaultEdgeHoverColor`
- `edgeHoverHighlightNodes`

### Features
Hovered edges can be drawn on the canvas hover context (enableEdgeHovering) with the ability to change their color (edgeHoverColor, defaultEdgeHoverColor) and size (edgeHoverSizeRatio). The node extremities of hovered edges can be highlighted (edgeHoverHighlightNodes).

### Improvements
The detection of the mouse over curved segments is experimental and should be improved (lot of maths!), see `sigma.utils.isPointOnQuadraticCurve`.

The parameters of the quad tree (maxLevels and maxElements) may be optimized. My intuition here is to study the impact of the layout type, the graph density and the degree distribution on the tree structure. It should work reasonnably well with force-directed layouts on real-world graphs (i.e. heterogeneous degree distribution).