Class WeaklyConnectedComponentsAlgorithm

    • Constructor Detail

      • WeaklyConnectedComponentsAlgorithm

        public WeaklyConnectedComponentsAlgorithm​(WeaklyConnectedComponentsData data)
        Parameters:
        data - Input data for this algorithm.
    • Method Detail

      • notifyStartComponent

        protected void notifyStartComponent​(Node curNode)
        Notify all observers that the algorithm is entering a new component.
        Parameters:
        curNode - Starting node for the component.
      • notifyNewNodeInComponent

        protected void notifyNewNodeInComponent​(Node node)
        Notify all observers that a new node has been found for the current component.
        Parameters:
        node - New node found for the current component.
      • notifyEndComponent

        protected void notifyEndComponent​(java.util.ArrayList<Node> nodes)
        Notify all observers that the algorithm has computed a new component.
        Parameters:
        nodes - List of nodes in the component.
      • createUndirectedGraph

        protected java.util.ArrayList<java.util.HashSet<java.lang.Integer>> createUndirectedGraph()
        Returns:
        An adjacency list for the undirected graph equivalent to the stored graph.
      • bfs

        protected java.util.ArrayList<Node> bfs​(java.util.ArrayList<java.util.HashSet<java.lang.Integer>> ugraph,
                                                boolean[] marked,
                                                int cur)
        Apply a breadth first search algorithm on the given undirected graph (adjacency list), starting at node cur, and marking nodes in marked.
        Parameters:
        marked -
        cur -
        Returns: