Method: Rubyvis::Layout::Matrix#sort
- Defined in:
- lib/rubyvis/layout/matrix.rb
#sort(f = nil, &block) ⇒ Object
Specifies an optional sort function. The sort function follows the same comparator contract required by pv.Dom.Node#sort. Specifying a sort function provides an alternative to sort the nodes as they are specified by the nodes property; the main advantage of doing this is that the comparator function can access implicit fields populated by the network layout, such as the linkDegree.
<p>Note that matrix visualizations are particularly sensitive to order. This is referred to as the seriation problem, and many different techniques exist to find good node orders that emphasize clusters, such as spectral layout and simulated annealing.
/
133 134 135 136 137 |
# File 'lib/rubyvis/layout/matrix.rb', line 133 def sort(f=nil,&block) f||=block @sort=f self end |