Performance Measurements: Connected Components

The following example uses this Performance Test function. In that link you can find more description about how to use this function.

1 import rod_lib_perftest2

Functions to be tested

1 #Initialize two list of function vector2: one by binary Adjacency Matrix e other for Infinite values
2 listF_bin = []
3 listF_inf = []

André

1 #Andre
2 import and_lib
3 fnc = [lambda x: len(set(and_lib.labelConnectedComponents(x))), 'labelConnectedComponents()', '`and_lib Andre`']
4 listF_bin.append(fnc)

Rodrigo

1 #Rodrigo
2 import rod_4
3 fnc = [lambda x: rod_4.rdCC(x).max(), 'rdCC(x)', 'Rodrigo']
4 listF_bin.append(fnc)

Roberto

1 from rob_biblio2 import countConnectedComponents
2 fnc = [lambda x: countConnectedComponents(x), 'countConnectedComponents', 'Roberto']
3 listF_inf.append(fnc)
/usr/local/lib/python2.6/dist-packages/scikits/__init__.py:1: UserWarning: Module dateutil was already imported from /usr/local/lib/python2.6/dist-packages/matplotlib-1.1.0-py2.6-linux-x86_64.egg/dateutil/__init__.pyc, but /usr/lib/pymodules/python2.6 is being added to sys.path
  __import__('pkg_resources').declare_namespace(__name__)

Giovani

1 import gio_lib
2 fnc = [lambda x: gio_lib.giCounterCC((x)), 'giCounterCC(x)', 'Giovani']
3 listF_bin.append(fnc)

Wendell

1 import wen_lib as w
2 fnc = [lambda x: w.countCCAdj(x), 'countCCAdj(x)', 'Wendell']
3 listF_inf.append(fnc)

Eric

1 from eri_lib import adj2ccList
2 fnc = [lambda x: len(adj2ccList(x)), 'adj2ccList(x)', 'Eric']
3 listF_inf.append(fnc)

Francisco

1 import fra_lib as fra
2 fnc = [lambda x: fra.compom(x),'compom(x)','Francisco']
3 listF_inf.append(fnc)

Tiago

1 from tia_libGraph import countGraphCC
2 fnc = [lambda x: countGraphCC(x), 'countGraphCC(x)', 'Tiago']
3 listF_bin.append(fnc)

Aline

1 import ali_lib
2 
3 fnc = [lambda x: ali_lib.countCompConexo(x), 'countCompConexo(x)', 'Aline']
4 listF_bin.append(fnc)
5 #listF_inf.append(fnc)

Fernanda

1 import fer_lib as fer
2 fnc = [lambda x: fer.countComponentsWeightedGraph(x,False), 'countComponentsWeightedGraph()', 'Fernanda']
3 listF_bin.append(fnc)

Wesley

1 import wes_lib as wes
2 fnc = [lambda x: wes.CountCC(x), 'CountCC(x)', 'Wesley']
3 listF_inf.append(fnc)

List of test values

Running tests

1 rod_lib_perftest2.runTests(listF_bin, listT_bin, 2, True)
2 
3 print "\n"
4 
5 rod_lib_perftest2.runTests(listF_inf, listT_inf, 2, True)
Autor Funcao Two components Result 500 phi=4/500 Result 500 phi=0 Result 500 phi=1 Result
Andre labelConnectedComponents() 0.149 ms (True) 2 16.756 ms (True) 10 9.439 ms (True) 500 17.83 ms (True) 1
Rodrigo rdCC(x) 0.297 ms (True) 2 26.554 ms (True) 10 23.5 ms (True) 500 1861.092 ms (True) 1
Giovani giCounterCC(x) 0.203 ms (True) 2 15.699 ms (True) 10 27.115 ms (True) 500 351.25 ms (True) 1
Tiago countGraphCC(x) 0.489 ms (True) 2 77.178 ms (True) 10 20.165 ms (True) 500 ERRO EXEC  
Aline countCompConexo(x) 0.692 ms (True) 2 ERRO EXEC   359.042 ms (True) 500 698.353 ms (True) 1
Fernanda countComponentsWeightedGraph() 0.322 ms (True) 2 2629.017 ms (True) 10 2645.26 ms (True) 500 8302.169 ms (True) 1
Autor Funcao Two components Result 500 phi=4/500 Result 500 phi=0 Result 500 phi=1 Result
Roberto countConnectedComponents 0.189 ms (True) 2 15.869 ms (True) 10 11.501 ms (True) 500 391.234 ms (True) 1
Wendell countCCAdj(x) 0.19 ms (True) 2 24.267 ms (True) 10 27.112 ms (True) 500 95.864 ms (True) 1
Eric adj2ccList(x) 0.235 ms (True) 2 15.176 ms (True) 10 26.542 ms (True) 500 396.02 ms (True) 1
Francisco compom(x) 0.133 ms (True) 2 11.825 ms (True) 10 11.222 ms (True) 500 66.009 ms (True) 1
Wesley CountCC(x) 0.152 ms (True) 2 12.695 ms (True) 10 10.874 ms (True) 500 65.353 ms (True) 1

Debug Tests

1 
Empty code fragment