// File: riyadparvez[P]louvain-method/graph.cpp
// Function: Graph::Graph(char*, int)
Graph::Graph(char *filename, int type) {
  ifstream finput;
  finput.open(filename,fstream::in);
  set<int> s; 
  int nb_links=0;

  while (!finput.eof()) {
    unsigned int src, dest;
    double weight=1.;

    if (type==WEIGHTED) {
      finput >> src >> dest >> weight;
    } else {
      finput >> src >> dest;
    }
    
    if (finput) {
      if (links.size()<=max(src,dest)+1) {
        links.resize(max(src,dest)+1);
      }
      
      links[src].push_back(make_pair(dest,weight));
      if (src!=dest)
        links[dest].push_back(make_pair(src,weight));
      s.insert(src);
      s.insert(dest);
      nb_links++;
    }
  }
  //copy(s.begin(), s.end(), nodes.begin());
  copy(s.begin(), s.end(), std::back_inserter(nodes));
  sort(nodes.begin(), nodes.end());
  finput.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x318(%rbp)
movq %rdi, %rax
movq %rax, -0x320(%rbp)
callq 0x3650
movq -0x318(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x310(%rbp)
callq 0x3670
leaq -0x220(%rbp), %rdi
callq 0x2180
jmp 0x2455
movq -0x10(%rbp), %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x20d0
jmp 0x246c
leaq -0x260(%rbp), %rdi
callq 0x3690
movl $0x0, -0x264(%rbp)
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x2270
movb %al, -0x321(%rbp)
jmp 0x24a2
movb -0x321(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x24b3
jmp 0x2822
movsd 0xab4d(%rip), %xmm0     # 0xd008
movsd %xmm0, -0x278(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2570
leaq -0x220(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x2040
movq %rax, -0x330(%rbp)
jmp 0x24e9
movq -0x330(%rbp), %rdi
leaq -0x26c(%rbp), %rsi
callq 0x2040
movq %rax, -0x338(%rbp)
jmp 0x2505
movq -0x338(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x2110
jmp 0x251a
jmp 0x25a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x2928
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x291c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x3a50
jmp 0x291c
leaq -0x220(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x2040
movq %rax, -0x340(%rbp)
jmp 0x258c
movq -0x340(%rbp), %rdi
leaq -0x26c(%rbp), %rsi
callq 0x2040
jmp 0x25a1
jmp 0x25a3
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x21b0
movb %al, -0x341(%rbp)
jmp 0x25c3
movb -0x341(%rbp), %al
testb $0x1, %al
jne 0x25d2
jmp 0x281d
movq -0x320(%rbp), %rdi
callq 0x36b0
movq %rax, -0x358(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x26c(%rbp), %rsi
callq 0x36e0
movq %rax, -0x350(%rbp)
jmp 0x2601
movq -0x358(%rbp), %rax
movq -0x350(%rbp), %rcx
movl (%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
ja 0x2662
movq -0x320(%rbp), %rax
movq %rax, -0x368(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x26c(%rbp), %rsi
callq 0x36e0
movq %rax, -0x360(%rbp)
jmp 0x2645
movq -0x368(%rbp), %rdi
movq -0x360(%rbp), %rax
movl (%rax), %eax
incl %eax
movl %eax, %esi
callq 0x3720
jmp 0x2660
jmp 0x2662
movq -0x320(%rbp), %rdi
movl -0x268(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, -0x380(%rbp)
leaq -0x26c(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3800
movsd %xmm0, -0x378(%rbp)
movl %eax, -0x36c(%rbp)
jmp 0x26a0
movsd -0x378(%rbp), %xmm0
movl -0x36c(%rbp), %eax
movl %eax, -0x290(%rbp)
movsd %xmm0, -0x288(%rbp)
leaq -0x280(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x3830
jmp 0x26d1
movq -0x380(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x37d0
jmp 0x26e6
movl -0x268(%rbp), %eax
cmpl -0x26c(%rbp), %eax
je 0x277e
movq -0x320(%rbp), %rdi
movl -0x26c(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, -0x398(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3800
movsd %xmm0, -0x390(%rbp)
movl %eax, -0x384(%rbp)
jmp 0x2736
movsd -0x390(%rbp), %xmm0
movl -0x384(%rbp), %eax
movl %eax, -0x2a8(%rbp)
movsd %xmm0, -0x2a0(%rbp)
leaq -0x298(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3830
jmp 0x2767
movq -0x398(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x37d0
jmp 0x277c
jmp 0x277e
movl -0x268(%rbp), %eax
movl %eax, -0x2ac(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0x2ac(%rbp), %rsi
callq 0x3860
movb %dl, -0x3a1(%rbp)
movq %rax, -0x3a0(%rbp)
jmp 0x27ac
movb -0x3a1(%rbp), %al
movq -0x3a0(%rbp), %rcx
movq %rcx, -0x2c0(%rbp)
movb %al, -0x2b8(%rbp)
movl -0x26c(%rbp), %eax
movl %eax, -0x2c4(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0x2c4(%rbp), %rsi
callq 0x3860
movb %dl, -0x3b1(%rbp)
movq %rax, -0x3b0(%rbp)
jmp 0x27f4
movb -0x3b1(%rbp), %al
movq -0x3b0(%rbp), %rcx
movq %rcx, -0x2d8(%rbp)
movb %al, -0x2d0(%rbp)
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x2482
leaq -0x260(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x3920
movq -0x3c8(%rbp), %rdi
movq %rax, -0x2e0(%rbp)
callq 0x3950
movq -0x320(%rbp), %rdi
movq %rax, -0x2e8(%rbp)
addq $0x18, %rdi
callq 0x3980
movq %rax, -0x3c0(%rbp)
jmp 0x2868
movq -0x3c0(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq -0x2e0(%rbp), %rdi
movq -0x2e8(%rbp), %rsi
movq -0x2f0(%rbp), %rdx
callq 0x38b0
movq %rax, -0x3d0(%rbp)
jmp 0x2899
movq -0x320(%rbp), %rdi
movq -0x3d0(%rbp), %rax
movq %rax, -0x2f8(%rbp)
addq $0x18, %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x39f0
movq -0x3d8(%rbp), %rdi
movq %rax, -0x300(%rbp)
callq 0x3a20
movq %rax, -0x308(%rbp)
movq -0x300(%rbp), %rdi
movq -0x308(%rbp), %rsi
callq 0x39b0
jmp 0x28ed
leaq -0x220(%rbp), %rdi
callq 0x2060
jmp 0x28fb
leaq -0x260(%rbp), %rdi
callq 0x3a50
leaq -0x220(%rbp), %rdi
callq 0x2070
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x2070
movq -0x310(%rbp), %rdi
callq 0x3a70
movq -0x318(%rbp), %rdi
callq 0x3ad0
movq -0x228(%rbp), %rdi
callq 0x2260
nopl (%rax)