shogun icon indicating copy to clipboard operation
shogun copied to clipboard

Implement an efficient graph colouring algorithm

Open karlnapf opened this issue 12 years ago • 20 comments

For graphs represented as large, sparse matrices. Since this should be efficient, a fast greedy algorithm is needed. Alternatively, integrate a library that can do that. Task includes a review on possible methods and to choose the "best". This is a preliminary task of the GSoC 2013 project idea of estimating large-scale Gaussian densities.

karlnapf avatar Feb 13 '13 19:02 karlnapf

are you open to parallel algorithms for this?

vikkamath avatar Mar 22 '13 11:03 vikkamath

We are totally open for parallel algorithms - assuming that you mean single-machine parallel. Preferably with openmp What method do you have in mind?

BTW: We aim to use this on large (and sparse) graphs (>100000 nodes and more)

karlnapf avatar Mar 24 '13 15:03 karlnapf

Hi, karlnapf: I am the first time here. If I implement this algorithm, should I use shogun api or write my own? Thanks

charnugagoo avatar Mar 25 '13 21:03 charnugagoo

Hi, karlnapf: I am so willing to try my algorithm that I cannot wait for your reply :p My greedy algorithm is like topology sort with priority queue, which is nearly linear on sparse graphs. (O(avg_degree*node_number), 3s for 100,000 nodes and 10,000,000 edges) I have implement it as an independent cpp program. For I am the first time here, I don't know the workflow, how to submit it.

Thanks~

charnugagoo avatar Mar 26 '13 00:03 charnugagoo

Hi Well, I was sleeping :) First of all, do you have a description of the method?
The complexity sounds exactly as what we want - how does it depend on the number of colors?

We merge code with pull requests on github, so you have to fork our repository, pull it to your computer, modify locally, commit locally, push, and send us a pull request.

I suggest you create a new class CSparseGraphColoring in the statistics folder of shogun. See any other shogun class or the development readme on how to do this. The next steps are unit-tests, an example, and documentation.

You can ask for details on IRC (heiko)

karlnapf avatar Mar 26 '13 10:03 karlnapf

Hi, karlnapf:

My algorithm is to greedy coloring nodes in sequence, from each node with max/min degree in each sub-graph to their neighbors using a priority queue, just like topology sort. I tried this algorithm on multiple data sets. On dataset of 100,000 nodes and 10,000,000 edges, 270+ max-degrees, programes use 47 colors.

I am learning the workflow and structure of shogun. I think I would come back fast after learning.

Thanks~

charnugagoo avatar Mar 27 '13 15:03 charnugagoo

Hi that sounds good. So grab a copy of shogun and send a pull request on github. Also, I would love to read a paper on the algorithm - could you provide one? Heiko

karlnapf avatar Mar 27 '13 18:03 karlnapf

It should be mentioned that it is preferable to do an d-distance colouring of the graph induced by the sparse matrix directly. Computing the power of a large sparse matrix before doing a 1- or 2-distance colouring bloats the memory usage unnecessarily.

Froskekongen avatar May 03 '13 19:05 Froskekongen

Agreed!

karlnapf avatar May 03 '13 21:05 karlnapf

https://github.com/shogun-toolbox/shogun/pull/1116 I write some code for your problem, but it something like prototype.

towelenee avatar May 19 '13 20:05 towelenee

closing as we are now using colpack

karlnapf avatar Feb 28 '14 00:02 karlnapf

I would advise against using ColPack as the final solution - as far as I remember it only supports up to 2-distance colouring. This makes it really inefficient if you are to make d in the d-distance colouring large, since a power of the adjacency matrix would explicitly need to be computed.

Froskekongen avatar Feb 28 '14 07:02 Froskekongen

@Froskekongen yeah that is true, but what would be the alternatives? This one at least works for now. What are you doing in KRYLSTAT?

karlnapf avatar Feb 28 '14 17:02 karlnapf

I use ColPack in KRYLSTAT, too, but I was exploring alternatives. In this article: http://www.stce.rwth-aachen.de/twiki/pub/Teaching/Summer10/SemCPSC/jacobian_color.pdf, there is an alternative for 2-distance colouring on page 22. It should be easy to add one more inner loop to extend it to 3-distance colouring, and perhaps it's possible to extend it to d-distance by a some clever recursion? I really didn't have time to explore this fully when doing this myself.

Froskekongen avatar Feb 28 '14 17:02 Froskekongen

Nice, thanks for that.

@lambday feel free to have a look at this. It's not top priority now (since the other stuff works - at least with reasonably conditioned matrices), but it might be really useful to continue on this in a bit.

karlnapf avatar Feb 28 '14 19:02 karlnapf

@karlnapf @Froskekongen Yeah I noticed that while implementing. I will give it a read and discuss here regarding possible implementations.

lambday avatar Feb 28 '14 20:02 lambday

Is this issue still open for contribution?

mmurrs avatar Jun 06 '20 21:06 mmurrs

You could have a go, but it is very low priority. I suggest to pick something else

karlnapf avatar Jun 06 '20 22:06 karlnapf

Ok, thanks for the quick response. Do you have a suggestion for a "good first issue" that would be better to work on?

mmurrs avatar Jun 06 '20 22:06 mmurrs

sort them by date and pick the most recent one, there are plenty of those ...

karlnapf avatar Jun 06 '20 23:06 karlnapf