/**
  * A subgraph is calculated based on the participants collected based on the given node ids.
  *
  * @param array $ids
  *   The nodes interested in.
  * @return DirectedGraph
  *   The subgraph with all participants
  */
 public function subGraph($ids = array())
 {
     $g = new DirectedGraph();
     $participants = $this->getParticipants($ids);
     foreach ($participants as $id) {
         $g->addNode($id);
         // Only participating links are added.
         $links = $this->getLinks($id);
         if (is_array($links)) {
             $g->addLinks($id, array_intersect($participants, $links));
         }
     }
     return $g;
 }