Class IntGraphImplQuadratic

  • All Implemented Interfaces:
    java.lang.Cloneable, IntGraph

    public class IntGraphImplQuadratic
    extends java.lang.Object
    implements IntGraph
    • Constructor Detail

      • IntGraphImplQuadratic

        public IntGraphImplQuadratic()
      • IntGraphImplQuadratic

        public IntGraphImplQuadratic​(int initialSize)
    • Method Detail

      • addEdge

        public void addEdge​(int source,
                            int target,
                            long weight)
        Description copied from interface: IntGraph
        Adds an edge. If the weight becomes 0, the edge is removed.
        Specified by:
        addEdge in interface IntGraph
      • getEdges

        public java.lang.Iterable<java.lang.Long> getEdges()
        Gives an iterable that iterates over all edges that have a weight greater than 0; The edges that are returned are indices.
        Specified by:
        getEdges in interface IntGraph
        Returns:
      • containsEdge

        public boolean containsEdge​(int source,
                                    int target)
        Returns whether the graph contains an edge between source and target.
        Specified by:
        containsEdge in interface IntGraph
        Returns:
      • getEdgeSource

        public int getEdgeSource​(long edgeIndex)
        Description copied from interface: IntGraph
        Returns the node the edgeIndex comes from.
        Specified by:
        getEdgeSource in interface IntGraph
        Returns:
      • getEdgeTarget

        public int getEdgeTarget​(long edgeIndex)
        Description copied from interface: IntGraph
        Returns the node the edgeIndex points to.
        Specified by:
        getEdgeTarget in interface IntGraph
        Returns:
      • getEdgeTargetIndex

        public int getEdgeTargetIndex​(long edgeIndex)
        Description copied from interface: IntGraph
        Returns the index of the node the edgeIndex points to.
        Specified by:
        getEdgeTargetIndex in interface IntGraph
        Returns:
      • getEdgeWeight

        public long getEdgeWeight​(long edgeIndex)
        Returns the weight of an edge.
        Specified by:
        getEdgeWeight in interface IntGraph
        Parameters:
        edgeIndex -
        Returns:
      • getEdgeWeight

        public long getEdgeWeight​(int source,
                                  int target)
        Description copied from interface: IntGraph
        Returns the weight of an edge between source and target.
        Specified by:
        getEdgeWeight in interface IntGraph
        Returns:
      • getIncomingEdgesOf

        public EdgeIterable getIncomingEdgesOf​(int node)
        Description copied from interface: IntGraph
        Returns an array of edge index, containing all edges of which v is the target. Notice that the edge weight might be 0.
        Specified by:
        getIncomingEdgesOf in interface IntGraph
        Returns:
      • getOutgoingEdgesOf

        public EdgeIterable getOutgoingEdgesOf​(int node)
        Description copied from interface: IntGraph
        Returns an array of edge index, containing all edges of which v is the source. Notice that the edge weight might be 0.
        Specified by:
        getOutgoingEdgesOf in interface IntGraph
        Returns:
      • getEdgesOf

        public java.lang.Iterable<java.lang.Long> getEdgesOf​(int node)
        Description copied from interface: IntGraph
        Return an iterable of edgeIndex containing all edges of which v is a source or a target. Notice that the edge weight might be 0.
        Specified by:
        getEdgesOf in interface IntGraph
        Returns:
      • getWeightOfHeaviestEdge

        public long getWeightOfHeaviestEdge()
        Returns the weight of the edge with the highest weight.
        Specified by:
        getWeightOfHeaviestEdge in interface IntGraph
        Returns:
      • addNode

        public void addNode​(int node)
        Description copied from interface: IntGraph
        Adds a node to the graph. Has no effect if the node was already present.
        Specified by:
        addNode in interface IntGraph
      • getNodes

        public int[] getNodes()
        Specified by:
        getNodes in interface IntGraph
        Returns:
        an array of the vertices in the graph.
      • getNodeOfIndex

        public int getNodeOfIndex​(int index)
        Description copied from interface: IntGraph
        The graph keeps an index of nodes. With this function, you can look up these indices.
        Specified by:
        getNodeOfIndex in interface IntGraph
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object