Class K1Coloring


  • public class K1Coloring
    extends org.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>

    This is a parallel implementation of the K1-Coloring algorithm. The Algorithm will assign a color to every node in the graph, trying to optimize for two objectives:

    • given a single node, make sure that every neigbor of that node has a different color
    • use as little colors as possible

    The implementation is a greedy implementation based on:
    Çatalyürek, Ümit V., et al. "Graph coloring algorithms for multi-core and massively multithreaded architectures." Parallel Computing 38.10-11 (2012): 576-594. https://arxiv.org/pdf/1205.3809.pdf

    The implementation is greedy, so it is not garantied to find an optimal solution, i.e. the coloring can be imperfect and contain more colors as needed.

    • Field Summary

      • Fields inherited from class org.neo4j.gds.Algorithm

        progressTracker, terminationFlag
    • Constructor Summary

      Constructors 
      Constructor Description
      K1Coloring​(org.neo4j.gds.api.Graph graph, long maxIterations, int minBatchSize, int concurrency, java.util.concurrent.ExecutorService executor, org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.neo4j.gds.core.utils.paged.HugeLongArray colors()  
      org.neo4j.gds.core.utils.paged.HugeLongArray compute()  
      boolean didConverge()  
      long ranIterations()  
      void release()  
      com.carrotsearch.hppc.BitSet usedColors()  
      • Methods inherited from class org.neo4j.gds.Algorithm

        getProgressTracker, getTerminationFlag, setTerminationFlag
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • K1Coloring

        public K1Coloring​(org.neo4j.gds.api.Graph graph,
                          long maxIterations,
                          int minBatchSize,
                          int concurrency,
                          java.util.concurrent.ExecutorService executor,
                          org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker)
    • Method Detail

      • release

        public void release()
        Specified by:
        release in class org.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>
      • ranIterations

        public long ranIterations()
      • didConverge

        public boolean didConverge()
      • usedColors

        public com.carrotsearch.hppc.BitSet usedColors()
      • colors

        public org.neo4j.gds.core.utils.paged.HugeLongArray colors()
      • compute

        public org.neo4j.gds.core.utils.paged.HugeLongArray compute()
        Specified by:
        compute in class org.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>