anchor.diff:  %% In the #louvain_graphd{}, the Communities are updated
   %% to reflect the paritioning.
   one_level(GD0 = #louvain_graphd{}, Weights0 = #louvain_weights{}, Modularity) ->
  +    % XXX make sure the graph is valid
  +    validate_graph(GD0),
   %   {ok, FD} = file:open("/tmp/part", [append]),
   %   file:write(FD, io_lib:format("starting communities: ~p~n", [lists:sort(dict:to_list(GD0#louvain_graphd.communitiesd))])),
   %   file:write(FD, io_lib:format("edges: ~p~n", [lists:sort(dict:to_list(GD0#louvain_graphd.edgesd))])),
  
positive.code: %% repeat the partitioning until there is no significant
  %% improvement in the modularity.
  partition(GD, L) ->
      Weights = weights(GD),
      Modularity = modularity(Weights),
      {PartitionedGD, NewModularity} = one_level(GD, Weights, Modularity),
  
negative.code:         end, [], CommunitiesPL).
  
  graph(Communities, Neighbors, Edges) ->
      #louvain_graph{
          communities = Communities,
          neighbors = Neighbors,
  