Program: 189781
Project: 189781
Buggy source:
CommunityStructure(HierarchicalUndirectedGraph hgraph){
  this.graph=hgraph;
  N=hgraph.getNodeCount();
  invMap=new HashMap<Integer,Community>();
  nodeConnections=new HashMap[N];
  nodeCommunities=new Community[N];
  map=new HashMap<Node,Integer>();
  topology=new LinkedList[N];
  communities=new LinkedList<Community>();
  int index=0;
  weights=new double[N];
  for (  Node node : hgraph.getNodes()) {
    map.put(node,index);
    nodeCommunities[index]=new Community(this);
    nodeConnections[index]=new HashMap<Community,Float>();
    weights[index]=0;
    nodeCommunities[index].seed(index);
    Community hidden=new Community(structure);
    hidden.nodes.add(index);
    invMap.put(index,hidden);
    communities.add(nodeCommunities[index]);
    index++;
    if (isCanceled) {
      return;
    }
  }
  for (  Node node : hgraph.getNodes()) {
    int node_index=map.get(node);
    topology[node_index]=new LinkedList<ModEdge>();
    for (    Node neighbor : hgraph.getNeighbors(node)) {
      if (node == neighbor) {
        continue;
      }
      int neighbor_index=map.get(neighbor);
      float weight=1;
      if (useWeight) {
        weight=hgraph.getEdge(node,neighbor).getWeight();
      }
      weights[node_index]+=weight;
      Modularity.ModEdge me=new ModEdge(node_index,neighbor_index,weight);
      topology[node_index].add(me);
      Community adjCom=nodeCommunities[neighbor_index];
      nodeConnections[node_index].put(adjCom,weight);
      nodeCommunities[node_index].connections.put(adjCom,weight);
      nodeConnections[neighbor_index].put(nodeCommunities[node_index],weight);
      nodeCommunities[neighbor_index].connections.put(nodeCommunities[node_index],weight);
      graphWeightSum+=weight;
    }
    if (isCanceled) {
      return;
    }
  }
  graphWeightSum/=2.0;
}

Fixed version (ground truth):
CommunityStructure(HierarchicalUndirectedGraph hgraph){
  this.graph=hgraph;
  N=hgraph.getNodeCount();
  invMap=new HashMap<Integer,Community>();
  nodeConnectionsWeight=new HashMap[N];
  nodeConnectionsCount=new HashMap[N];
  nodeCommunities=new Community[N];
  map=new HashMap<Node,Integer>();
  topology=new LinkedList[N];
  communities=new LinkedList<Community>();
  int index=0;
  weights=new double[N];
  for (  Node node : hgraph.getNodes()) {
    map.put(node,index);
    nodeCommunities[index]=new Community(this);
    nodeConnectionsWeight[index]=new HashMap<Community,Float>();
    nodeConnectionsCount[index]=new HashMap<Community,Integer>();
    weights[index]=0;
    nodeCommunities[index].seed(index);
    Community hidden=new Community(structure);
    hidden.nodes.add(index);
    invMap.put(index,hidden);
    communities.add(nodeCommunities[index]);
    index++;
    if (isCanceled) {
      return;
    }
  }
  for (  Node node : hgraph.getNodes()) {
    int node_index=map.get(node);
    topology[node_index]=new LinkedList<ModEdge>();
    for (    Node neighbor : hgraph.getNeighbors(node)) {
      if (node == neighbor) {
        continue;
      }
      int neighbor_index=map.get(neighbor);
      float weight=1;
      if (useWeight) {
        weight=hgraph.getEdge(node,neighbor).getWeight();
      }
      weights[node_index]+=weight;
      Modularity.ModEdge me=new ModEdge(node_index,neighbor_index,weight);
      topology[node_index].add(me);
      Community adjCom=nodeCommunities[neighbor_index];
      nodeConnectionsWeight[node_index].put(adjCom,weight);
      nodeConnectionsCount[node_index].put(adjCom,1);
      nodeCommunities[node_index].connectionsWeight.put(adjCom,weight);
      nodeCommunities[node_index].connectionsCount.put(adjCom,1);
      nodeConnectionsWeight[neighbor_index].put(nodeCommunities[node_index],weight);
      nodeConnectionsCount[neighbor_index].put(nodeCommunities[node_index],1);
      nodeCommunities[neighbor_index].connectionsWeight.put(nodeCommunities[node_index],weight);
      nodeCommunities[neighbor_index].connectionsCount.put(nodeCommunities[node_index],1);
      graphWeightSum+=weight;
    }
    if (isCanceled) {
      return;
    }
  }
  graphWeightSum/=2.0;
}