/**
  * Returns the tags that are related to one or more other tags, with their
  * associated weight (see deppPropelActAsTaggableToolkit::normalize for more
  * details).
  * The "related tags" of one tag are the ones which have at least one
  * taggable object in common.
  *
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      mixed       $tags
  * @param      array       $options
  * @return     array
  */
 public static function getRelatedTags($tags = array(), $options = array())
 {
     $tags = deppPropelActAsTaggableToolkit::explodeTagString($tags);
     if (is_string($tags)) {
         $tags = array($tags);
     }
     $tagging_options = $options;
     $taggings = self::getTaggings($tags, $tagging_options);
     $result = array();
     foreach ($taggings as $key => $tagging) {
         $c = new Criteria();
         $c->add(TagPeer::NAME, $tags, Criteria::NOT_IN);
         $c->add(TaggingPeer::TAGGABLE_ID, $tagging, Criteria::IN);
         $c->add(TaggingPeer::TAGGABLE_MODEL, $key);
         $c->addJoin(TaggingPeer::TAG_ID, TagPeer::ID);
         $tag_objects = TagPeer::doSelect($c);
         foreach ($tag_objects as $tag) {
             if (!isset($result[$tag->getName()])) {
                 $result[$tag->getName()] = 0;
             }
             $result[$tag->getName()]++;
         }
     }
     if (isset($options['limit'])) {
         arsort($result);
         $result = array_slice($result, 0, $options['limit'], true);
     }
     ksort($result);
     return deppPropelActAsTaggableToolkit::normalize($result);
 }