Esempio n. 1
0
 /// <summary>
 /// Initializes a flow edge from another flow edge.</summary>
 /// <param name="e">the edge to copy</param>
 ///
 public FlowEdge(FlowEdge e)
 {
     v        = e.v;
     w        = e.w;
     capacity = e.capacity;
     flow     = e.flow;
 }
Esempio n. 2
0
        /// <summary>
        /// Adds the edge <c>e</c> to the network.</summary>
        /// <param name="e">the edge</param>
        /// <exception cref="IndexOutOfRangeException">unless endpoints of edge are between 0 and V-1</exception>
        ///
        public void AddEdge(FlowEdge e)
        {
            int v = e.From;
            int w = e.To;

            validateVertex(v);
            validateVertex(w);
            adj[v].Add(e);
            adj[w].Add(e);
            numEdges++;
        }
Esempio n. 3
0
        /// <summary>
        /// Demo test the <c>FlowEdge</c> data type.</summary>
        /// <param name="args">Place holder for user arguments</param>
        ///
        public static void MainTest(string[] args)
        {
            FlowEdge e = new FlowEdge(12, 23, 3.14);

            Console.WriteLine(e);
        }