예제 #1
0
        public NetronAdaptorGraph(
            IMutableBidirectionalVertexAndEdgeListGraph g,
            NetronPanel panel,
            IShapeVertexProvider shapeProvider,
            IConnectionEdgeProvider connectionProvider,
            IConnectorChooser connectorChooser
            )
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            if (panel == null)
            {
                throw new ArgumentNullException("panel");
            }
            if (shapeProvider == null)
            {
                throw new ArgumentNullException("shapeArgument");
            }
            if (connectionProvider == null)
            {
                throw new ArgumentNullException("connectionProvider");
            }
            if (connectorChooser == null)
            {
                throw new ArgumentNullException("connectorChooser");
            }

            this.visitedGraph       = g;
            this.panel              = panel;
            this.shapeProvider      = shapeProvider;
            this.connectionProvider = connectionProvider;
            this.connectorChooser   = connectorChooser;
        }
        public GraphBalancerAlgorithm(
            IMutableBidirectionalVertexAndEdgeListGraph visitedGraph,
            IVertex source,
            IVertex sink,
            EdgeDoubleDictionary capacities)
        {
            if (visitedGraph == null)
                throw new ArgumentNullException("visitedGraph");
            if (source == null)
                throw new ArgumentNullException("source");
            if (!visitedGraph.ContainsVertex(source))
                throw new ArgumentException("source is not part of the graph");
            if (sink == null)
                throw new ArgumentNullException("sink");
            if (!visitedGraph.ContainsVertex(sink))
                throw new ArgumentException("sink is not part of the graph");
            if (capacities == null)
                throw new ArgumentNullException("capacities");

            this.visitedGraph = visitedGraph;
            this.source = source;
            this.sink = sink;
            this.capacities = capacities;

            // setting preflow = l(e) = 1
            foreach (IEdge edge in this.VisitedGraph.Edges)
                this.preFlow.Add(edge, 1);
        }
        public NetronAdaptorGraph(
            IMutableBidirectionalVertexAndEdgeListGraph g,
            NetronPanel panel,
            IShapeVertexProvider shapeProvider,
            IConnectionEdgeProvider connectionProvider,
            IConnectorChooser connectorChooser
            )
        {
            if (g==null)
                throw new ArgumentNullException("g");
            if (panel==null)
                throw new ArgumentNullException("panel");
            if (shapeProvider==null)
                throw new ArgumentNullException("shapeArgument");
            if (connectionProvider==null)
                throw new ArgumentNullException("connectionProvider");
            if (connectorChooser == null)
                throw new ArgumentNullException("connectorChooser");

            this.visitedGraph = g;
            this.panel = panel;
            this.shapeProvider = shapeProvider;
            this.connectionProvider = connectionProvider;
            this.connectorChooser = connectorChooser;
        }
 /// <summary>
 /// Creates a mutable tree wrapper
 /// </summary>
 /// <param name="g">wrapped graph</param>
 /// <param name="allowCycles">cycle tolerance</param>
 public MutableTreeAdapterGraph(
     IMutableBidirectionalVertexAndEdgeListGraph g,
     bool allowCycles)
     : base(g)
 {
     this.mutableWrapped = g;
     this.allowCycles = allowCycles;
 }
예제 #5
0
 /// <summary>
 /// Creates a mutable tree wrapper
 /// </summary>
 /// <param name="g">wrapped graph</param>
 /// <param name="allowCycles">cycle tolerance</param>
 public MutableTreeAdapterGraph(
     IMutableBidirectionalVertexAndEdgeListGraph g,
     bool allowCycles)
     : base(g)
 {
     this.mutableWrapped = g;
     this.allowCycles    = allowCycles;
 }
 public GraphBalancerAlgorithm(IMutableBidirectionalVertexAndEdgeListGraph visitedGraph, IVertex source, IVertex sink)
 {
     this.source = null;
     this.sink = null;
     this.balancingSource = null;
     this.balancingSourceEdge = null;
     this.balancingSink = null;
     this.balancingSinkEdge = null;
     this.capacities = new EdgeDoubleDictionary();
     this.preFlow = new EdgeIntDictionary();
     this.surplusVertices = new VertexCollection();
     this.surplusEdges = new EdgeCollection();
     this.deficientVertices = new VertexCollection();
     this.deficientEdges = new EdgeCollection();
     this.balanced = false;
     if (visitedGraph == null)
     {
         throw new ArgumentNullException("visitedGraph");
     }
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (!visitedGraph.ContainsVertex(source))
     {
         throw new ArgumentException("source is not part of the graph");
     }
     if (sink == null)
     {
         throw new ArgumentNullException("sink");
     }
     if (!visitedGraph.ContainsVertex(sink))
     {
         throw new ArgumentException("sink is not part of the graph");
     }
     this.visitedGraph = visitedGraph;
     this.source = source;
     this.sink = sink;
     IEdgeEnumerator enumerator = this.VisitedGraph.get_Edges().GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         this.capacities.Add(edge, double.MaxValue);
     }
     IEdgeEnumerator enumerator2 = this.VisitedGraph.get_Edges().GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge edge2 = enumerator2.get_Current();
         this.preFlow.Add(edge2, 1);
     }
 }
예제 #7
0
        public GraphBalancerAlgorithm(
            IMutableBidirectionalVertexAndEdgeListGraph visitedGraph,
            IVertex source,
            IVertex sink,
            EdgeDoubleDictionary capacities)
        {
            if (visitedGraph == null)
            {
                throw new ArgumentNullException("visitedGraph");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (!visitedGraph.ContainsVertex(source))
            {
                throw new ArgumentException("source is not part of the graph");
            }
            if (sink == null)
            {
                throw new ArgumentNullException("sink");
            }
            if (!visitedGraph.ContainsVertex(sink))
            {
                throw new ArgumentException("sink is not part of the graph");
            }
            if (capacities == null)
            {
                throw new ArgumentNullException("capacities");
            }

            this.visitedGraph = visitedGraph;
            this.source       = source;
            this.sink         = sink;
            this.capacities   = capacities;

            // setting preflow = l(e) = 1
            foreach (IEdge edge in this.VisitedGraph.Edges)
            {
                this.preFlow.Add(edge, 1);
            }
        }