Class MaximumFlowAbstract

    • Constructor Detail

      • MaximumFlowAbstract

        public MaximumFlowAbstract()
        Default constructor.
    • Method Detail

      • computeMaximumFlow

        public <V,​E> Flow<V,​E> computeMaximumFlow​(Graph<V,​E> g,
                                                              WeightFunction<E> capacity,
                                                              V source,
                                                              V sink)
        Description copied from interface: MaximumFlow
        Calculate the maximum flow in a network between a source and a sink.

        Some algorithm might run faster for integer capacities, and WeightFunctionInt can be passed as capacity.

        If g is an IntGraph, its better to pass a IWeightFunction as capacity to avoid boxing/unboxing. If g is an IntGraph, the returned object is IFlow.

        Specified by:
        computeMaximumFlow in interface MaximumFlow
        Type Parameters:
        V - the vertices type
        E - the edges type
        Parameters:
        g - a graph
        capacity - a capacity edge weight function
        source - a source vertex
        sink - a sink vertex
        Returns:
        the flows computed for each edge
      • computeMaximumFlow

        public <V,​E> Flow<V,​E> computeMaximumFlow​(Graph<V,​E> g,
                                                              WeightFunction<E> capacity,
                                                              Collection<V> sources,
                                                              Collection<V> sinks)
        Description copied from interface: MaximumFlow
        Calculate the maximum flow in a network between a set of sources and a set of sinks.

        Some algorithm might run faster for integer capacities, and WeightFunctionInt can be passed as capacity.

        If g is an IntGraph, its better to pass a IWeightFunction as capacity to avoid boxing/unboxing. If g is an IntGraph, the returned object is IFlow.

        Specified by:
        computeMaximumFlow in interface MaximumFlow
        Type Parameters:
        V - the vertices type
        E - the edges type
        Parameters:
        g - a graph
        capacity - a capacity edge weight function
        sources - a set of source vertices
        sinks - a set of sink vertices
        Returns:
        the flows computed for each edge