Package com.jgalgo

Interface ConnectedComponentsAlgo.Result

  • Enclosing interface:
    ConnectedComponentsAlgo

    public static interface ConnectedComponentsAlgo.Result
    Result object for connectivity components calculation.

    The result object contains the partition of the vertices into the connectivity components (strongly for directed graph). Each connectivity component (CC) is assigned a unique integer number in range [0, ccNum), and each vertex can be queried for its CC using getVertexCc(int).

    Author:
    Barak Ugav
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      it.unimi.dsi.fastutil.ints.IntCollection getCcEdges​(int ccIdx)
      Get all the edges that are part of a connectivity component.
      it.unimi.dsi.fastutil.ints.IntCollection getCcVertices​(int ccIdx)
      Get all the vertices that are part of a connectivity component.
      int getNumberOfCcs()
      Get the number of connectivity components in the graph.
      int getVertexCc​(int vertex)
      Get the connectivity component containing a vertex.
    • Method Detail

      • getVertexCc

        int getVertexCc​(int vertex)
        Get the connectivity component containing a vertex.
        Parameters:
        vertex - a vertex in the graph
        Returns:
        index of the connectivity component containing the vertex, in range [0, ccNum)
      • getNumberOfCcs

        int getNumberOfCcs()
        Get the number of connectivity components in the graph.
        Returns:
        the number of connectivity components in the graph, non negative number
      • getCcVertices

        it.unimi.dsi.fastutil.ints.IntCollection getCcVertices​(int ccIdx)
        Get all the vertices that are part of a connectivity component.
        Parameters:
        ccIdx - index of a connectivity component
        Returns:
        the vertices that are part of the connectivity components
        Throws:
        IndexOutOfBoundsException - if ccIdx is negative or greater than the number of connectivity components
      • getCcEdges

        it.unimi.dsi.fastutil.ints.IntCollection getCcEdges​(int ccIdx)
        Get all the edges that are part of a connectivity component.

        An edge \((u,v)\) is part of a connectivity component if both \(u\) and \(v\) are part of the connectivity component.

        Parameters:
        ccIdx - index of a connectivity component
        Returns:
        the edges that are part of the connectivity components
        Throws:
        IndexOutOfBoundsException - if ccIdx is negative or greater than the number of connectivity components