           {
             source: nodes.indexOf node
             target: nodes.indexOf other_node
-            similarities: @similarity_types().map (similarity_type) ->
+            similarities: @active_similarity_types().map (similarity_type) ->
               {
                 type: similarity_type
                 list: similarities[similarity_type]

    Math.log( d3.max([2, @link_weight(d)]) ) * 5

  draw_link_by_buttons: (links) ->
    similarity_types = []
    for link in links
      for similarity in link.similarities
        similarity_types.push(similarity.type) unless similarity_types.indexOf(similarity.type) > -1

    $similarity_types_container = $('#similarity-types')

    $similarity_types_container.html ''

    for type in similarity_types
      formatted_type = type[0].toUpperCase() + type[1..-1]
      $similarity_types_container.append """
        <button class="btn btn-default btn-block active" data-similarity-type="#{type}">#{formatted_type}</button>
      """


  node_size: (d) ->
    d3.max [10, Math.log( d.authors.length + 1 ) * 10]


class ScholarMapViz.CharacteristicsMap extends ScholarMapViz.Map

  constructor: ->
    @type = 'characteristics'
    super

  similarity_types: ->
    ['people', 'references']

  # node tooltips should display the characteristic names
  node_tip_html: (d) ->
    d.name


class ScholarMapViz.DataToggle

  constructor:  ->
    $('#map-types').on 'click', 'button', ->
      $current_button = $(@)
      choose_data $current_button, ->
        ScholarMapViz.current_map = new ScholarMapViz[$current_button.data('map-type')]

  choose_data = ($current, activation_callback) ->
    unless $current.hasClass 'active'
