In [65]:
using Laplacians
using DataStructures
include("../src/flowClustering.jl")
include("../src/cutHeuristics.jl")
include("../src/localClustering.jl")


Out[65]:
apr_local (generic function with 1 method)

In [34]:
a = readIJ("/Users/serbanstan/Downloads/emailEnron.txt", '\t');

In [74]:
a = chimera(10000)
include("../src/localClustering.jl"); @time s = prn_local(a, [1], 0.5, 1)
println(length(s))


  0.085396 seconds (43.48 k allocations: 2.082 MB)
6

In [77]:
minEpsSigma = getVolume(a, s) / getVolume(a, setdiff(collect(1:max(a.n, a.m)), s))
@time cut, flow = localImprove(a, s, epsSigma = minEpsSigma, err = 1e-5, maxSize = 10000);
condcut = compConductance(a, cut)

@time heur_refcut = refineCut(a, s)
condref = compConductance(a, heur_refcut)
    
@time heur_dumb = dumb(a, s)
conddumb = compConductance(a, heur_dumb)


0.5 70 10.87831313429896
0.25 70 2.878313134299006
0.125 9972 0.0
0.1875 9998 0.0
0.21875 70 0.5925988485846752
0.203125 9992 0.0
0.2109375 9984 0.0
0.21484375 70 0.2601313161171248
0.212890625 70 0.08932230861085699
0.2119140625 9993 0.0
0.21240234375 70 0.04612922625295468
0.212158203125 70 0.024458128545184366
0.2120361328125 70 0.0
0.21209716796875 70 0.0
0.212127685546875 70 0.0
0.2121429443359375 70 0.023102028782133743
0.21213531494140625 70 0.022423905742904537
  
Out[77]:
1.0
6.574691 seconds (58.75 M allocations: 1.958 GB, 7.13% gc time)
  0.007622 seconds (79.26 k allocations: 2.075 MB)
  0.008709 seconds (59.67 k allocations: 932.563 KB, 65.98% gc time)

In [78]:
println(compConductance(a, s), " ", length(s))
println(condcut, " ", length(cut))
println(condref, " ", length(condref))
println(conddumb)


0.47368421052631576 6
0.018691588785046728 70
0.5 1
1.0

In [ ]:


In [ ]:


In [ ]:
for i in 1:30000
    println("************ ", i)
    
    a = chimera(30000)
    
    s = prn_local(a, [i], 0.5, 1)
    println(length(s))
    
    if length(s) > 0
    
        minEpsSigma = getVolume(a, s) / getVolume(a, setdiff(collect(1:max(a.n, a.m)), s))
        @time cut, flow = localImprove(a, s, epsSigma = minEpsSigma);
        condcut = compConductance(a, cut)

        @time heur_refcut = refineCut(a, s)
        condref = compConductance(a, heur_refcut)

        @time heur_dumb = dumb(a, s)
        conddumb = compConductance(a, heur_dumb)

        println(compConductance(a, s), " ", length(s))
        println(condcut, " ", length(cut))
        println(condref, " ", length(heur_refcut))
        println(conddumb, " ", length(heur_dumb))

    end
end

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:
a = chimera(1000000)
@time s = prn(a, [1,2,3], 0.5, 3);
@time s2 = prn_local(a, [1,2,3], 0.5, 3);

In [ ]:
for i in 1:100
    a = chimera(100)
    s = prn(a, [1,2,3], 0.5, 3); #println(compConductance(a, s))
    s2 = prn_local(a, [1,2,3], 0.5, 3); #println(compConductance(a, s2))
    
    c1 = compConductance(a, s)
    c2 = compConductance(a, s2)
    
    if c1 != c2
        println(i, "? ", c1, " ", c2)
    end
end