Python Reference: Network Flow and Graph

Module pywrapgraph

Expand source code
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.1
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError("Python 2.7 or later required")

# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _pywrapgraph
else:
    import _pywrapgraph

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class SimpleMaxFlow(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.SimpleMaxFlow_swiginit(self, _pywrapgraph.new_SimpleMaxFlow())

    def AddArcWithCapacity(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity") -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMaxFlow_AddArcWithCapacity(self, tail, head, capacity)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMaxFlow_NumArcs(self)

    def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_Tail(self, arc)

    def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_Head(self, arc)

    def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_Capacity(self, arc)
    OPTIMAL = _pywrapgraph.SimpleMaxFlow_OPTIMAL
    POSSIBLE_OVERFLOW = _pywrapgraph.SimpleMaxFlow_POSSIBLE_OVERFLOW
    BAD_INPUT = _pywrapgraph.SimpleMaxFlow_BAD_INPUT
    BAD_RESULT = _pywrapgraph.SimpleMaxFlow_BAD_RESULT

    def Solve(self, source: "operations_research::NodeIndex", sink: "operations_research::NodeIndex") -> "operations_research::SimpleMaxFlow::Status":
        return _pywrapgraph.SimpleMaxFlow_Solve(self, source, sink)

    def OptimalFlow(self) -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_OptimalFlow(self)

    def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_Flow(self, arc)

    def GetSourceSideMinCut(self) -> "void":
        return _pywrapgraph.SimpleMaxFlow_GetSourceSideMinCut(self)

    def GetSinkSideMinCut(self) -> "void":
        return _pywrapgraph.SimpleMaxFlow_GetSinkSideMinCut(self)

    def SetArcCapacity(self, arc: "operations_research::ArcIndex", capacity: "operations_research::FlowQuantity") -> "void":
        return _pywrapgraph.SimpleMaxFlow_SetArcCapacity(self, arc, capacity)
    __swig_destroy__ = _pywrapgraph.delete_SimpleMaxFlow

# Register SimpleMaxFlow in _pywrapgraph:
_pywrapgraph.SimpleMaxFlow_swigregister(SimpleMaxFlow)

class MinCostFlowBase(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    NOT_SOLVED = _pywrapgraph.MinCostFlowBase_NOT_SOLVED
    OPTIMAL = _pywrapgraph.MinCostFlowBase_OPTIMAL
    FEASIBLE = _pywrapgraph.MinCostFlowBase_FEASIBLE
    INFEASIBLE = _pywrapgraph.MinCostFlowBase_INFEASIBLE
    UNBALANCED = _pywrapgraph.MinCostFlowBase_UNBALANCED
    BAD_RESULT = _pywrapgraph.MinCostFlowBase_BAD_RESULT
    BAD_COST_RANGE = _pywrapgraph.MinCostFlowBase_BAD_COST_RANGE

    def __init__(self):
        _pywrapgraph.MinCostFlowBase_swiginit(self, _pywrapgraph.new_MinCostFlowBase())
    __swig_destroy__ = _pywrapgraph.delete_MinCostFlowBase

# Register MinCostFlowBase in _pywrapgraph:
_pywrapgraph.MinCostFlowBase_swigregister(MinCostFlowBase)

class SimpleMinCostFlow(MinCostFlowBase):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.SimpleMinCostFlow_swiginit(self, _pywrapgraph.new_SimpleMinCostFlow())

    def AddArcWithCapacityAndUnitCost(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity", unit_cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMinCostFlow_AddArcWithCapacityAndUnitCost(self, tail, head, capacity, unit_cost)

    def SetNodeSupply(self, node: "operations_research::NodeIndex", supply: "operations_research::FlowQuantity") -> "void":
        return _pywrapgraph.SimpleMinCostFlow_SetNodeSupply(self, node, supply)

    def Solve(self) -> "operations_research::MinCostFlowBase::Status":
        return _pywrapgraph.SimpleMinCostFlow_Solve(self)

    def SolveMaxFlowWithMinCost(self) -> "operations_research::MinCostFlowBase::Status":
        return _pywrapgraph.SimpleMinCostFlow_SolveMaxFlowWithMinCost(self)

    def OptimalCost(self) -> "operations_research::CostValue":
        return _pywrapgraph.SimpleMinCostFlow_OptimalCost(self)

    def MaximumFlow(self) -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_MaximumFlow(self)

    def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Flow(self, arc)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMinCostFlow_NumArcs(self)

    def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_Tail(self, arc)

    def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_Head(self, arc)

    def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Capacity(self, arc)

    def Supply(self, node: "operations_research::NodeIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Supply(self, node)

    def UnitCost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
        return _pywrapgraph.SimpleMinCostFlow_UnitCost(self, arc)
    __swig_destroy__ = _pywrapgraph.delete_SimpleMinCostFlow

# Register SimpleMinCostFlow in _pywrapgraph:
_pywrapgraph.SimpleMinCostFlow_swigregister(SimpleMinCostFlow)

class LinearSumAssignment(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.LinearSumAssignment_swiginit(self, _pywrapgraph.new_LinearSumAssignment())

    def AddArcWithCost(self, left_node: "operations_research::NodeIndex", right_node: "operations_research::NodeIndex", cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
        return _pywrapgraph.LinearSumAssignment_AddArcWithCost(self, left_node, right_node, cost)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.LinearSumAssignment_NumArcs(self)

    def LeftNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_LeftNode(self, arc)

    def RightNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_RightNode(self, arc)

    def Cost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_Cost(self, arc)
    OPTIMAL = _pywrapgraph.LinearSumAssignment_OPTIMAL
    INFEASIBLE = _pywrapgraph.LinearSumAssignment_INFEASIBLE
    POSSIBLE_OVERFLOW = _pywrapgraph.LinearSumAssignment_POSSIBLE_OVERFLOW

    def Solve(self) -> "operations_research::SimpleLinearSumAssignment::Status":
        return _pywrapgraph.LinearSumAssignment_Solve(self)

    def OptimalCost(self) -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_OptimalCost(self)

    def RightMate(self, left_node: "operations_research::NodeIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_RightMate(self, left_node)

    def AssignmentCost(self, left_node: "operations_research::NodeIndex") -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_AssignmentCost(self, left_node)
    __swig_destroy__ = _pywrapgraph.delete_LinearSumAssignment

# Register LinearSumAssignment in _pywrapgraph:
_pywrapgraph.LinearSumAssignment_swigregister(LinearSumAssignment)


def DijkstraShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.DijkstraShortestPath(node_count, start_node, end_node, graph, disconnected_distance)

def BellmanFordShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.BellmanFordShortestPath(node_count, start_node, end_node, graph, disconnected_distance)

def AStarShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", heuristic: "std::function< int64 (int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.AStarShortestPath(node_count, start_node, end_node, graph, heuristic, disconnected_distance)
Functions

AStarShortestPath

def AStarShortestPath(node_count: int, start_node: int, end_node: int, graph: std::function< int64 (int,int) >, heuristic: std::function< int64 (int) >, disconnected_distance: int64) -> 'std::vector< int > *'
Expand source code
def AStarShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", heuristic: "std::function< int64 (int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.AStarShortestPath(node_count, start_node, end_node, graph, heuristic, disconnected_distance)

BellmanFordShortestPath

def BellmanFordShortestPath(node_count: int, start_node: int, end_node: int, graph: std::function< int64 (int,int) >, disconnected_distance: int64) -> 'std::vector< int > *'
Expand source code
def BellmanFordShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.BellmanFordShortestPath(node_count, start_node, end_node, graph, disconnected_distance)

DijkstraShortestPath

def DijkstraShortestPath(node_count: int, start_node: int, end_node: int, graph: std::function< int64 (int,int) >, disconnected_distance: int64) -> 'std::vector< int > *'
Expand source code
def DijkstraShortestPath(node_count: "int", start_node: "int", end_node: "int", graph: "std::function< int64 (int,int) >", disconnected_distance: "int64") -> "std::vector< int > *":
    return _pywrapgraph.DijkstraShortestPath(node_count, start_node, end_node, graph, disconnected_distance)
Classes

LinearSumAssignment

class LinearSumAssignment
Expand source code
class LinearSumAssignment(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.LinearSumAssignment_swiginit(self, _pywrapgraph.new_LinearSumAssignment())

    def AddArcWithCost(self, left_node: "operations_research::NodeIndex", right_node: "operations_research::NodeIndex", cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
        return _pywrapgraph.LinearSumAssignment_AddArcWithCost(self, left_node, right_node, cost)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.LinearSumAssignment_NumArcs(self)

    def LeftNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_LeftNode(self, arc)

    def RightNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_RightNode(self, arc)

    def Cost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_Cost(self, arc)
    OPTIMAL = _pywrapgraph.LinearSumAssignment_OPTIMAL
    INFEASIBLE = _pywrapgraph.LinearSumAssignment_INFEASIBLE
    POSSIBLE_OVERFLOW = _pywrapgraph.LinearSumAssignment_POSSIBLE_OVERFLOW

    def Solve(self) -> "operations_research::SimpleLinearSumAssignment::Status":
        return _pywrapgraph.LinearSumAssignment_Solve(self)

    def OptimalCost(self) -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_OptimalCost(self)

    def RightMate(self, left_node: "operations_research::NodeIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.LinearSumAssignment_RightMate(self, left_node)

    def AssignmentCost(self, left_node: "operations_research::NodeIndex") -> "operations_research::CostValue":
        return _pywrapgraph.LinearSumAssignment_AssignmentCost(self, left_node)
    __swig_destroy__ = _pywrapgraph.delete_LinearSumAssignment
Class variables

INFEASIBLE

var INFEASIBLE

OPTIMAL

var OPTIMAL

POSSIBLE_OVERFLOW

var POSSIBLE_OVERFLOW
Instance variables

thisown

var thisown

The membership flag

Expand source code
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
Methods

AddArcWithCost

def AddArcWithCost(self, left_node: operations_research::NodeIndex, right_node: operations_research::NodeIndex, cost: operations_research::CostValue) -> 'operations_research::ArcIndex'
Expand source code
def AddArcWithCost(self, left_node: "operations_research::NodeIndex", right_node: "operations_research::NodeIndex", cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
    return _pywrapgraph.LinearSumAssignment_AddArcWithCost(self, left_node, right_node, cost)

AssignmentCost

def AssignmentCost(self, left_node: operations_research::NodeIndex) -> 'operations_research::CostValue'
Expand source code
def AssignmentCost(self, left_node: "operations_research::NodeIndex") -> "operations_research::CostValue":
    return _pywrapgraph.LinearSumAssignment_AssignmentCost(self, left_node)

Cost

def Cost(self, arc: operations_research::ArcIndex) -> 'operations_research::CostValue'
Expand source code
def Cost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
    return _pywrapgraph.LinearSumAssignment_Cost(self, arc)

LeftNode

def LeftNode(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def LeftNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.LinearSumAssignment_LeftNode(self, arc)

NumArcs

def NumArcs(self) -> 'operations_research::ArcIndex'
Expand source code
def NumArcs(self) -> "operations_research::ArcIndex":
    return _pywrapgraph.LinearSumAssignment_NumArcs(self)

NumNodes

def NumNodes(self) -> 'operations_research::NodeIndex'
Expand source code
def NumNodes(self) -> "operations_research::NodeIndex":
    return _pywrapgraph.LinearSumAssignment_NumNodes(self)

OptimalCost

def OptimalCost(self) -> 'operations_research::CostValue'
Expand source code
def OptimalCost(self) -> "operations_research::CostValue":
    return _pywrapgraph.LinearSumAssignment_OptimalCost(self)

RightMate

def RightMate(self, left_node: operations_research::NodeIndex) -> 'operations_research::NodeIndex'
Expand source code
def RightMate(self, left_node: "operations_research::NodeIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.LinearSumAssignment_RightMate(self, left_node)

RightNode

def RightNode(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def RightNode(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.LinearSumAssignment_RightNode(self, arc)

Solve

def Solve(self) -> 'operations_research::SimpleLinearSumAssignment::Status'
Expand source code
def Solve(self) -> "operations_research::SimpleLinearSumAssignment::Status":
    return _pywrapgraph.LinearSumAssignment_Solve(self)

MinCostFlowBase

class MinCostFlowBase
Expand source code
class MinCostFlowBase(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    NOT_SOLVED = _pywrapgraph.MinCostFlowBase_NOT_SOLVED
    OPTIMAL = _pywrapgraph.MinCostFlowBase_OPTIMAL
    FEASIBLE = _pywrapgraph.MinCostFlowBase_FEASIBLE
    INFEASIBLE = _pywrapgraph.MinCostFlowBase_INFEASIBLE
    UNBALANCED = _pywrapgraph.MinCostFlowBase_UNBALANCED
    BAD_RESULT = _pywrapgraph.MinCostFlowBase_BAD_RESULT
    BAD_COST_RANGE = _pywrapgraph.MinCostFlowBase_BAD_COST_RANGE

    def __init__(self):
        _pywrapgraph.MinCostFlowBase_swiginit(self, _pywrapgraph.new_MinCostFlowBase())
    __swig_destroy__ = _pywrapgraph.delete_MinCostFlowBase
Subclasses
Class variables

BAD_COST_RANGE

var BAD_COST_RANGE

BAD_RESULT

var BAD_RESULT

FEASIBLE

var FEASIBLE

INFEASIBLE

var INFEASIBLE

NOT_SOLVED

var NOT_SOLVED

OPTIMAL

var OPTIMAL

UNBALANCED

var UNBALANCED
Instance variables

thisown

var thisown

The membership flag

Expand source code
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

SimpleMaxFlow

class SimpleMaxFlow
Expand source code
class SimpleMaxFlow(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.SimpleMaxFlow_swiginit(self, _pywrapgraph.new_SimpleMaxFlow())

    def AddArcWithCapacity(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity") -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMaxFlow_AddArcWithCapacity(self, tail, head, capacity)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMaxFlow_NumArcs(self)

    def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_Tail(self, arc)

    def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMaxFlow_Head(self, arc)

    def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_Capacity(self, arc)
    OPTIMAL = _pywrapgraph.SimpleMaxFlow_OPTIMAL
    POSSIBLE_OVERFLOW = _pywrapgraph.SimpleMaxFlow_POSSIBLE_OVERFLOW
    BAD_INPUT = _pywrapgraph.SimpleMaxFlow_BAD_INPUT
    BAD_RESULT = _pywrapgraph.SimpleMaxFlow_BAD_RESULT

    def Solve(self, source: "operations_research::NodeIndex", sink: "operations_research::NodeIndex") -> "operations_research::SimpleMaxFlow::Status":
        return _pywrapgraph.SimpleMaxFlow_Solve(self, source, sink)

    def OptimalFlow(self) -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_OptimalFlow(self)

    def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMaxFlow_Flow(self, arc)

    def GetSourceSideMinCut(self) -> "void":
        return _pywrapgraph.SimpleMaxFlow_GetSourceSideMinCut(self)

    def GetSinkSideMinCut(self) -> "void":
        return _pywrapgraph.SimpleMaxFlow_GetSinkSideMinCut(self)

    def SetArcCapacity(self, arc: "operations_research::ArcIndex", capacity: "operations_research::FlowQuantity") -> "void":
        return _pywrapgraph.SimpleMaxFlow_SetArcCapacity(self, arc, capacity)
    __swig_destroy__ = _pywrapgraph.delete_SimpleMaxFlow
Class variables

BAD_INPUT

var BAD_INPUT

BAD_RESULT

var BAD_RESULT

OPTIMAL

var OPTIMAL

POSSIBLE_OVERFLOW

var POSSIBLE_OVERFLOW
Instance variables

thisown

var thisown

The membership flag

Expand source code
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
Methods

AddArcWithCapacity

def AddArcWithCapacity(self, tail: operations_research::NodeIndex, head: operations_research::NodeIndex, capacity: operations_research::FlowQuantity) -> 'operations_research::ArcIndex'
Expand source code
def AddArcWithCapacity(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity") -> "operations_research::ArcIndex":
    return _pywrapgraph.SimpleMaxFlow_AddArcWithCapacity(self, tail, head, capacity)

Capacity

def Capacity(self, arc: operations_research::ArcIndex) -> 'operations_research::FlowQuantity'
Expand source code
def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMaxFlow_Capacity(self, arc)

Flow

def Flow(self, arc: operations_research::ArcIndex) -> 'operations_research::FlowQuantity'
Expand source code
def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMaxFlow_Flow(self, arc)

GetSinkSideMinCut

def GetSinkSideMinCut(self) -> 'void'
Expand source code
def GetSinkSideMinCut(self) -> "void":
    return _pywrapgraph.SimpleMaxFlow_GetSinkSideMinCut(self)

GetSourceSideMinCut

def GetSourceSideMinCut(self) -> 'void'
Expand source code
def GetSourceSideMinCut(self) -> "void":
    return _pywrapgraph.SimpleMaxFlow_GetSourceSideMinCut(self)
def Head(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMaxFlow_Head(self, arc)

NumArcs

def NumArcs(self) -> 'operations_research::ArcIndex'
Expand source code
def NumArcs(self) -> "operations_research::ArcIndex":
    return _pywrapgraph.SimpleMaxFlow_NumArcs(self)

NumNodes

def NumNodes(self) -> 'operations_research::NodeIndex'
Expand source code
def NumNodes(self) -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMaxFlow_NumNodes(self)

OptimalFlow

def OptimalFlow(self) -> 'operations_research::FlowQuantity'
Expand source code
def OptimalFlow(self) -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMaxFlow_OptimalFlow(self)

SetArcCapacity

def SetArcCapacity(self, arc: operations_research::ArcIndex, capacity: operations_research::FlowQuantity) -> 'void'
Expand source code
def SetArcCapacity(self, arc: "operations_research::ArcIndex", capacity: "operations_research::FlowQuantity") -> "void":
    return _pywrapgraph.SimpleMaxFlow_SetArcCapacity(self, arc, capacity)

Solve

def Solve(self, source: operations_research::NodeIndex, sink: operations_research::NodeIndex) -> 'operations_research::SimpleMaxFlow::Status'
Expand source code
def Solve(self, source: "operations_research::NodeIndex", sink: "operations_research::NodeIndex") -> "operations_research::SimpleMaxFlow::Status":
    return _pywrapgraph.SimpleMaxFlow_Solve(self, source, sink)

Tail

def Tail(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMaxFlow_Tail(self, arc)

SimpleMinCostFlow

class SimpleMinCostFlow
Expand source code
class SimpleMinCostFlow(MinCostFlowBase):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _pywrapgraph.SimpleMinCostFlow_swiginit(self, _pywrapgraph.new_SimpleMinCostFlow())

    def AddArcWithCapacityAndUnitCost(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity", unit_cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMinCostFlow_AddArcWithCapacityAndUnitCost(self, tail, head, capacity, unit_cost)

    def SetNodeSupply(self, node: "operations_research::NodeIndex", supply: "operations_research::FlowQuantity") -> "void":
        return _pywrapgraph.SimpleMinCostFlow_SetNodeSupply(self, node, supply)

    def Solve(self) -> "operations_research::MinCostFlowBase::Status":
        return _pywrapgraph.SimpleMinCostFlow_Solve(self)

    def SolveMaxFlowWithMinCost(self) -> "operations_research::MinCostFlowBase::Status":
        return _pywrapgraph.SimpleMinCostFlow_SolveMaxFlowWithMinCost(self)

    def OptimalCost(self) -> "operations_research::CostValue":
        return _pywrapgraph.SimpleMinCostFlow_OptimalCost(self)

    def MaximumFlow(self) -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_MaximumFlow(self)

    def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Flow(self, arc)

    def NumNodes(self) -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_NumNodes(self)

    def NumArcs(self) -> "operations_research::ArcIndex":
        return _pywrapgraph.SimpleMinCostFlow_NumArcs(self)

    def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_Tail(self, arc)

    def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
        return _pywrapgraph.SimpleMinCostFlow_Head(self, arc)

    def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Capacity(self, arc)

    def Supply(self, node: "operations_research::NodeIndex") -> "operations_research::FlowQuantity":
        return _pywrapgraph.SimpleMinCostFlow_Supply(self, node)

    def UnitCost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
        return _pywrapgraph.SimpleMinCostFlow_UnitCost(self, arc)
    __swig_destroy__ = _pywrapgraph.delete_SimpleMinCostFlow
Ancestors
Methods

AddArcWithCapacityAndUnitCost

def AddArcWithCapacityAndUnitCost(self, tail: operations_research::NodeIndex, head: operations_research::NodeIndex, capacity: operations_research::FlowQuantity, unit_cost: operations_research::CostValue) -> 'operations_research::ArcIndex'
Expand source code
def AddArcWithCapacityAndUnitCost(self, tail: "operations_research::NodeIndex", head: "operations_research::NodeIndex", capacity: "operations_research::FlowQuantity", unit_cost: "operations_research::CostValue") -> "operations_research::ArcIndex":
    return _pywrapgraph.SimpleMinCostFlow_AddArcWithCapacityAndUnitCost(self, tail, head, capacity, unit_cost)

Capacity

def Capacity(self, arc: operations_research::ArcIndex) -> 'operations_research::FlowQuantity'
Expand source code
def Capacity(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMinCostFlow_Capacity(self, arc)

Flow

def Flow(self, arc: operations_research::ArcIndex) -> 'operations_research::FlowQuantity'
Expand source code
def Flow(self, arc: "operations_research::ArcIndex") -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMinCostFlow_Flow(self, arc)

Head

def Head(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def Head(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMinCostFlow_Head(self, arc)

MaximumFlow

def MaximumFlow(self) -> 'operations_research::FlowQuantity'
Expand source code
def MaximumFlow(self) -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMinCostFlow_MaximumFlow(self)

NumArcs

def NumArcs(self) -> 'operations_research::ArcIndex'
Expand source code
def NumArcs(self) -> "operations_research::ArcIndex":
    return _pywrapgraph.SimpleMinCostFlow_NumArcs(self)

NumNodes

def NumNodes(self) -> 'operations_research::NodeIndex'
Expand source code
def NumNodes(self) -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMinCostFlow_NumNodes(self)

OptimalCost

def OptimalCost(self) -> 'operations_research::CostValue'
Expand source code
def OptimalCost(self) -> "operations_research::CostValue":
    return _pywrapgraph.SimpleMinCostFlow_OptimalCost(self)

SetNodeSupply

def SetNodeSupply(self, node: operations_research::NodeIndex, supply: operations_research::FlowQuantity) -> 'void'
Expand source code
def SetNodeSupply(self, node: "operations_research::NodeIndex", supply: "operations_research::FlowQuantity") -> "void":
    return _pywrapgraph.SimpleMinCostFlow_SetNodeSupply(self, node, supply)

Solve

def Solve(self) -> 'operations_research::MinCostFlowBase::Status'
Expand source code
def Solve(self) -> "operations_research::MinCostFlowBase::Status":
    return _pywrapgraph.SimpleMinCostFlow_Solve(self)

SolveMaxFlowWithMinCost

def SolveMaxFlowWithMinCost(self) -> 'operations_research::MinCostFlowBase::Status'
Expand source code
def SolveMaxFlowWithMinCost(self) -> "operations_research::MinCostFlowBase::Status":
    return _pywrapgraph.SimpleMinCostFlow_SolveMaxFlowWithMinCost(self)

Supply

def Supply(self, node: operations_research::NodeIndex) -> 'operations_research::FlowQuantity'
Expand source code
def Supply(self, node: "operations_research::NodeIndex") -> "operations_research::FlowQuantity":
    return _pywrapgraph.SimpleMinCostFlow_Supply(self, node)

Tail

def Tail(self, arc: operations_research::ArcIndex) -> 'operations_research::NodeIndex'
Expand source code
def Tail(self, arc: "operations_research::ArcIndex") -> "operations_research::NodeIndex":
    return _pywrapgraph.SimpleMinCostFlow_Tail(self, arc)

UnitCost

def UnitCost(self, arc: operations_research::ArcIndex) -> 'operations_research::CostValue'
Expand source code
def UnitCost(self, arc: "operations_research::ArcIndex") -> "operations_research::CostValue":
    return _pywrapgraph.SimpleMinCostFlow_UnitCost(self, arc)
Inherited members