Show / Hide Table of Contents

Class GraphBalancerAlgorithm<TVertex, TEdge>

Algorithm that computes a the graph balancing by finding vertices causing surplus or deficits.

Inheritance
System.Object
GraphBalancerAlgorithm<TVertex, TEdge>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

GraphBalancerAlgorithm(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

visitedGraph is null.

System.ArgumentNullException

source is null.

System.ArgumentNullException

sink is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

System.ArgumentException

visitedGraph does not contain source vertex.

System.ArgumentException

visitedGraph does not contain sink vertex.

| Improve this Doc View Source

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

visitedGraph is null.

System.ArgumentNullException

source is null.

System.ArgumentNullException

sink is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

System.ArgumentNullException

capacities is null.

System.ArgumentException

visitedGraph does not contain source vertex.

System.ArgumentException

visitedGraph does not contain sink vertex.

Properties

| Improve this Doc View Source

Balanced

Indicates if the graph has been balanced or not.

Declaration
public bool Balanced { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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).

| Improve this Doc View Source

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).

| Improve this Doc View Source

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).

| Improve this Doc View Source

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).

| Improve this Doc View Source

Capacities

Edges capacities.

Declaration
public IDictionary<TEdge, double> Capacities { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<TEdge, System.Double>
| Improve this Doc View Source

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

EdgeFactory

Edge factory method.

Declaration
public EdgeFactory<TVertex, TEdge> EdgeFactory { get; }
Property Value
Type Description
EdgeFactory<TVertex, TEdge>
| Improve this Doc View Source

Sink

Flow sink vertex.

Declaration
public TVertex Sink { get; }
Property Value
Type Description
TVertex
| Improve this Doc View Source

Source

Flow source vertex.

Declaration
public TVertex Source { get; }
Property Value
Type Description
TVertex
| Improve this Doc View Source

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

VertexFactory

Vertex factory method.

Declaration
public VertexFactory<TVertex> VertexFactory { get; }
Property Value
Type Description
VertexFactory<TVertex>
| Improve this Doc View Source

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 Source

Balance()

Runs the graph balancing algorithm.

Declaration
public void Balance()
Exceptions
Type Condition
System.InvalidOperationException

If the graph is already balanced.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 Source

BalancingSinkAdded

Fired when the BalancingSink is added to the graph.

Declaration
public event VertexAction<TVertex> BalancingSinkAdded
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

BalancingSourceAdded

Fired when the BalancingSource is added to the graph.

Declaration
public event VertexAction<TVertex> BalancingSourceAdded
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

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>
| Improve this Doc View Source

EdgeAdded

Fired when an edge is added to the graph.

Declaration
public event EdgeAction<TVertex, TEdge> EdgeAdded
Event Type
Type Description
EdgeAction<TVertex, TEdge>
| Improve this Doc View Source

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>

Extension Methods

GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, XmlReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, String, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String, Action<XmlWriter, TGraph>, Action<XmlWriter, TVertex>, Action<XmlWriter, TEdge>)
  • Improve this Doc
  • View Source
In This Article
Back to top QuikGraph