We test out the LightGraph package, to see how easy it is to use with ours, and to compare its speed. It is easy to make a LightGraphs data type. You just put in the adjacency matrix. Since this also works for directed graphs, it could be nice to use their directed graph routines. But, they are slower.
using Laplacians
using LightGraphs
a = grid2(1000) # Laplacians style graph
lg = Graph(a) # LightGraphs style
@time is_connected(lg)
@time isConnected(a)
Let's subsample, and test out the speed of connected components routines.
as = subsampleEdges(a,0.5);
lgs = Graph(as)
@time c = components(as);
@time lgc = connected_components(lgs);
Let's check if they give the same answers.
vecToComps(c)
lgc
To be sure that we are not being unfair in running time, let's time the vecToComps, too.
@time v = vecToComps(c);