Matlab中graphmaxflow函数的用法
Purposes用途
Calculate maximum flow in directed graph
用于计算有向图中的最大流
如果大家遇到求无向图中最大流的时候可以先将有向图转换成无向图再进行求解。
Syntax 用法
[MaxFlow, FlowMatrix, Cut] = graphmaxflow(G, SNode, TNode)
[...] = graphmaxflow(G, SNode, TNode, ...'Capacity', CapacityValue, ...)
[...] = graphmaxflow(G, SNode, TNode, ...'Method', MethodValue, ...)
Arguments
GN-by-N | sparse matrix that represents a directed graph. Nonzeroentries in matrix G represent the capacities ofthe edges. |
SNode | Node in G. |
TNode | Node in G. |
Capacity | ValueColumn vector that specifies custom capacities for the edgesin matrix G. It must have one entry forevery nonzero value (edge) in matrix G.The order of the custom capacities in the vector must match the orderof the nonzero values in matrix G whenit is traversed column-wise. By default, graphmaxflow getscapacity information from the nonzero entries in matrix G. |
MethodValue | String that specifies the algorithm used to find the minimalspanning tree (MST). Choices are: |
‘Edmonds’ — Uses the Edmondsand Karp algorithm, the implementation of which is based on a variationcalled the labeling algorith |