Class Prim


  • public class Prim
    extends org.neo4j.gds.Algorithm<SpanningTree>
    Sequential Single-Source minimum weight spanning tree algorithm (PRIM).

    The algorithm computes the MST by traversing all nodes from a given startNodeId. It aggregates all transitions into a MinPriorityQueue and visits each (unvisited) connected node by following only the cheapest transition and adding it to a specialized form of undirected tree.

    The algorithm also computes the minimum, maximum and sum of all weights in the MST.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.DoubleUnaryOperator MAX_OPERATOR  
      static java.util.function.DoubleUnaryOperator MIN_OPERATOR  
      • Fields inherited from class org.neo4j.gds.Algorithm

        progressTracker, terminationFlag
    • Constructor Summary

      Constructors 
      Constructor Description
      Prim​(org.neo4j.gds.api.Graph graph, java.util.function.DoubleUnaryOperator minMax, long startNodeId, org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker)  
    • Field Detail

      • MAX_OPERATOR

        public static final java.util.function.DoubleUnaryOperator MAX_OPERATOR
      • MIN_OPERATOR

        public static final java.util.function.DoubleUnaryOperator MIN_OPERATOR
    • Constructor Detail

      • Prim

        public Prim​(org.neo4j.gds.api.Graph graph,
                    java.util.function.DoubleUnaryOperator minMax,
                    long startNodeId,
                    org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker)
    • Method Detail

      • release

        public void release()
        Specified by:
        release in class org.neo4j.gds.Algorithm<SpanningTree>