anchor.diff:          end, [], CommunitiesPL).
   
   graph(Communities, Neighbors, Edges) ->
  -    % XXX validation - edges are unique, neighbors are unique
  -    % XXX edges are unique
  -%   ?ASSERTEQUAL(lists:sort(Edges), lists:usort(Edges)),
  -    % XXX edges unique in neighbors
  -%   lists:foreach(
  -%       fun({_Node, NeighborNodes}) ->
  -%           ?ASSERTEQUAL(lists:sort(NeighborNodes), lists:usort(NeighborNodes))
  -%       end, Neighbors),
       #louvain_graph{
           communities = Communities,
           neighbors = Neighbors,
  
positive.code: %% In the #louvain_graphd{}, the Communities are updated
  %% to reflect the paritioning.
  one_level(GD0 = #louvain_graphd{}, Weights0 = #louvain_weights{}, Modularity) ->
  %   {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))])),
  
negative.code:             end, [], NeighborsD)),
      Edges = sets:from_list(dict:fetch_keys(EdgesD)),
      ?ASSERTEQUAL(true, sets:is_subset(NeighborEdges, Edges) andalso
                          sets:is_subset(Edges, NeighborEdges)).
  
  vg_list_unique(L) ->
      ?ASSERTEQUAL(lists:sort(L), lists:usort(L)).
  