code: def _community_fastgreedy(graph, weights=None):
      """Community structure based on the greedy optimization of modularity.
  
      This algorithm merges individual nodes into communities in a way that
      greedily maximizes the modularity score of the graph. It can be proven
      that if no merge can increase the current modularity score, the
      algorithm can be stopped since no further increase can be achieved.
  
      This algorithm is said to run almost in linear time on sparse graphs.
  
      B{Reference}: A Clauset, MEJ Newman and C Moore: Finding community structure
      in very large networks. I{Phys Rev E} 70, 066111 (2004).
  
      @param weights: edge attribute name or a list containing edge
        weights
      @return: an appropriate L{VertexDendrogram} object.
      """
      merges, qs = GraphBase.community_fastgreedy(graph, weights)
      optimal_count = _optimal_cluster_count_from_merges_and_modularity(
          graph, merges, qs
      )
      return VertexDendrogram(
          graph,
          merges,
          optimal_count,
          modularity_params={"weights": weights},
      )
  
file_path: python-igraph/src/igraph/community.py
imports: from igraph._igraph import GraphBase
  from igraph.clustering import VertexDendrogram, VertexClustering
  from igraph.utils import deprecated
  from typing import List, Sequence, Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: _community_fastgreedy(graph, weights) and returns: VertexDendrogram