Class GraphBalancerAlgorithm<TVertex, TEdge>
Algorithm that computes a the graph balancing by finding vertices causing surplus or deficits.
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms.MaximumFlow
Assembly: QuikGraph.dll
Syntax
public sealed class GraphBalancerAlgorithm<TVertex, TEdge>
where TEdge : IEdge<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Constructors
| Improve this Doc View SourceGraphBalancerAlgorithm(IMutableBidirectionalGraph<TVertex, TEdge>, TVertex, TVertex, VertexFactory<TVertex>, EdgeFactory<TVertex, TEdge>)
Initializes a new instance of the GraphBalancerAlgorithm<TVertex, TEdge> class.
Declaration
public GraphBalancerAlgorithm(IMutableBidirectionalGraph<TVertex, TEdge> visitedGraph, TVertex source, TVertex sink, VertexFactory<TVertex> vertexFactory, EdgeFactory<TVertex, TEdge> edgeFactory)
Parameters
Type | Name | Description |
---|---|---|
IMutableBidirectionalGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
TVertex | source | Flow source vertex. |
TVertex | sink | Flow sink vertex. |
VertexFactory<TVertex> | vertexFactory | Vertex factory method. |
EdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
GraphBalancerAlgorithm(IMutableBidirectionalGraph<TVertex, TEdge>, TVertex, TVertex, VertexFactory<TVertex>, EdgeFactory<TVertex, TEdge>, IDictionary<TEdge, Double>)
Initializes a new instance of the GraphBalancerAlgorithm<TVertex, TEdge> class.
Declaration
public GraphBalancerAlgorithm(IMutableBidirectionalGraph<TVertex, TEdge> visitedGraph, TVertex source, TVertex sink, VertexFactory<TVertex> vertexFactory, EdgeFactory<TVertex, TEdge> edgeFactory, IDictionary<TEdge, double> capacities)
Parameters
Type | Name | Description |
---|---|---|
IMutableBidirectionalGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
TVertex | source | Flow source vertex. |
TVertex | sink | Flow sink vertex. |
VertexFactory<TVertex> | vertexFactory | Vertex factory method. |
EdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
System.Collections.Generic.IDictionary<TEdge, System.Double> | capacities | Edges capacities. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
Properties
| Improve this Doc View SourceBalanced
Indicates if the graph has been balanced or not.
Declaration
public bool Balanced { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BalancingSink
Balancing flow sink vertex.
Declaration
public TVertex BalancingSink { get; }
Property Value
Type | Description |
---|---|
TVertex |
Remarks
Not null if the algorithm has been run (and not reverted).
BalancingSinkEdge
Balancing sink edge (between Sink and BalancingSink).
Declaration
public TEdge BalancingSinkEdge { get; }
Property Value
Type | Description |
---|---|
TEdge |
Remarks
Not null if the algorithm has been run (and not reverted).
BalancingSource
Balancing flow source vertex.
Declaration
public TVertex BalancingSource { get; }
Property Value
Type | Description |
---|---|
TVertex |
Remarks
Not null if the algorithm has been run (and not reverted).
BalancingSourceEdge
Balancing source edge (between BalancingSource and Source).
Declaration
public TEdge BalancingSourceEdge { get; }
Property Value
Type | Description |
---|---|
TEdge |
Remarks
Not null if the algorithm has been run (and not reverted).
Capacities
Edges capacities.
Declaration
public IDictionary<TEdge, double> Capacities { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<TEdge, System.Double> |
DeficientEdges
Enumerable of edges linked to vertices that add deficit to the graph balance.
Declaration
public IEnumerable<TEdge> DeficientEdges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TEdge> |
DeficientVertices
Enumerable of vertices that add deficit to the graph balance.
Declaration
public IEnumerable<TVertex> DeficientVertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TVertex> |
EdgeFactory
Edge factory method.
Declaration
public EdgeFactory<TVertex, TEdge> EdgeFactory { get; }
Property Value
Type | Description |
---|---|
EdgeFactory<TVertex, TEdge> |
Sink
Flow sink vertex.
Declaration
public TVertex Sink { get; }
Property Value
Type | Description |
---|---|
TVertex |
Source
Flow source vertex.
Declaration
public TVertex Source { get; }
Property Value
Type | Description |
---|---|
TVertex |
SurplusEdges
Enumerable of edges linked to vertices that add surplus to the graph balance.
Declaration
public IEnumerable<TEdge> SurplusEdges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TEdge> |
SurplusVertices
Enumerable of vertices that add surplus to the graph balance.
Declaration
public IEnumerable<TVertex> SurplusVertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TVertex> |
VertexFactory
Vertex factory method.
Declaration
public VertexFactory<TVertex> VertexFactory { get; }
Property Value
Type | Description |
---|---|
VertexFactory<TVertex> |
VisitedGraph
Gets the graph to visit with this algorithm.
Declaration
public IMutableBidirectionalGraph<TVertex, TEdge> VisitedGraph { get; }
Property Value
Type | Description |
---|---|
IMutableBidirectionalGraph<TVertex, TEdge> |
Methods
| Improve this Doc View SourceBalance()
Runs the graph balancing algorithm.
Declaration
public void Balance()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If the graph is already balanced. |
GetBalancingIndex(TVertex)
Gets the balancing index of the given vertex
.
Declaration
public int GetBalancingIndex(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | Vertex to get balancing index. |
Returns
Type | Description |
---|---|
System.Int32 | Balancing index. |
UnBalance()
Runs the graph unbalancing algorithm.
Declaration
public void UnBalance()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If the graph is not balanced. |
Events
| Improve this Doc View SourceBalancingSinkAdded
Fired when the BalancingSink is added to the graph.
Declaration
public event VertexAction<TVertex> BalancingSinkAdded
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
BalancingSourceAdded
Fired when the BalancingSource is added to the graph.
Declaration
public event VertexAction<TVertex> BalancingSourceAdded
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
DeficientVertexAdded
Fired when a vertex adding a deficit to the balance is found and added to DeficientVertices.
Declaration
public event VertexAction<TVertex> DeficientVertexAdded
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
EdgeAdded
Fired when an edge is added to the graph.
Declaration
public event EdgeAction<TVertex, TEdge> EdgeAdded
Event Type
Type | Description |
---|---|
EdgeAction<TVertex, TEdge> |
SurplusVertexAdded
Fired when a vertex adding surplus to the balance is found and added to SurplusVertices.
Declaration
public event VertexAction<TVertex> SurplusVertexAdded
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |