コード例 #1
0
 /// <summary>
 /// Returns the product of graph-A and graph-B. Alternatively, the operator _graphA * _graphB could also be use to represent the same thing
 /// </summary>
 /// <param name="_graphA"> The first graph </param>
 /// <param name="_graphB"> The second graph </param>
 ///	<param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Return the product of both graphs </returns>
 public static Graph Multiply(Graph _graphA, Graph _graphB, GraphCycle _enumgraphCycle)
 {
     return(new Graph((float x) =>
     {
         return MultiplyAsFloat(_graphA, _graphB, x);
     }, _enumgraphCycle));
 }
コード例 #2
0
 /// <summary>
 /// Creates a graph from the average of graph-A and graph-B
 /// </summary>
 /// <param name="_graphA"> The first graph </param>
 /// <param name="_graphB"> The second graph </param>
 /// <param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Returns the average of both graph </returns>
 public static Graph Average(Graph _graphA, Graph _graphB, GraphCycle _enumGraphCycle)
 {
     return(new Graph((float x) =>
     {
         return AverageAsFloat(_graphA, _graphB, x);
     }, _enumGraphCycle));
 }
コード例 #3
0
 /// <summary>
 /// Creates a graph of graph-A with a certain percentage influenced from graph-B
 /// </summary>
 /// <param name="_graphA"> The initial graph A </param>
 /// <param name="_graphB"> The influencing graph B </param>
 /// <param name="_fBInfluence"> The percentage of influenced from the influencing graph B </param>
 /// <param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Returns a graph that mixed the two graphs together </returns>
 public static Graph Mix(Graph _graphA, Graph _graphB, float _fBInfluence, GraphCycle _enumGraphCycle)
 {
     return(new Graph((float x) =>
     {
         return MixAsFloat(_graphA, _graphB, _fBInfluence, x);
     }, _enumGraphCycle));
 }
コード例 #4
0
ファイル: GraphView.xaml.cs プロジェクト: mitxael/SSHIVA
        private void ShowCyclesList()
        {
            /// Create List of cycles
            GraphCycles = new List <GraphCycle>();
            foreach (var item in GraphFromLibrary.minimumCycleBasis.Select((value, idx) => new { value, idx }))
            {
                var cycle = item.value;
                var index = item.idx;

                double        _weight = Math.Round(GraphFromLibrary.minimumCycleBasis_w[index], 4);
                int           _edges  = cycle.Where(c => c == 1).ToArray().Length;
                StringBuilder _cycle  = new System.Text.StringBuilder();

                foreach (var edg in cycle.Select((value, idx) => new { value, idx }))
                {
                    if (edg.value == 1)
                    {
                        string v1 = GraphFromLibrary.EdgesReference[edg.idx].Item1.ToString();
                        string v2 = GraphFromLibrary.EdgesReference[edg.idx].Item2.ToString();
                        _cycle.Append("(" + v1 + "," + v2 + ") ");
                    }
                }

                GraphCycle gc = new GraphCycle {
                    Weight = _weight, Edges = _edges, Cycle = _cycle.ToString()
                };
                GraphCycles.Add(gc);
            }

            /// Assign List to DataGrid
            this.DataGrid1.ItemsSource = GraphCycles;
            this.DataGrid1.Columns.Clear();
            this.DataGrid1.AutoGenerateColumns = false;
            this.DataGrid1.AutoGenerateColumns = true;
            this.DataGrid1.Columns[0].Header   = "W";
            this.DataGrid1.Columns[1].Header   = "E";
            this.DataGrid1.Columns[2].Header   = "Cycle";
            this.DataGrid1.Items.Refresh();

            /// Autosize columns
            foreach (DataGridColumn column in DataGrid1.Columns)
            {
                column.Width = new DataGridLength(1.0, DataGridLengthUnitType.SizeToCells);
            }
        }
コード例 #5
0
ファイル: Graph.cs プロジェクト: Daburu/Daburu-Tools
 /// <summary>
 /// Create a parametric graph instance
 /// </summary>
 /// <param name="_explicitFunction"> The delegate that contains a parametric graph equation </param>
 public Graph(ExplicitFunction _explicitFunction)
 {
     m_delEquation = _explicitFunction;
         enum_graphCycle = GraphCycle.None;
 }
コード例 #6
0
ファイル: Graph.cs プロジェクト: Daburu/Daburu-Tools
 /// <summary>
 /// Returns the product of graph-A and graph-B. Alternatively, the operator _graphA * _graphB could also be use to represent the same thing
 /// </summary>
 /// <param name="_graphA"> The first graph </param>
 /// <param name="_graphB"> The second graph </param>
 ///	<param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Return the product of both graphs </returns>
 public static Graph Multiply(Graph _graphA, Graph _graphB, GraphCycle _enumgraphCycle)
 {
     return new Graph((float x) =>
         {
             return MultiplyAsFloat(_graphA, _graphB, x);
         }, _enumgraphCycle);
 }
コード例 #7
0
ファイル: Graph.cs プロジェクト: Daburu/Daburu-Tools
        private ExplicitFunction m_delEquation; // m_delEquation: The delegate to store the graph function

        #endregion Fields

        #region Constructors

        // Constructors
        public Graph(ExplicitFunction _explicitFunction, GraphCycle _graphCycle)
        {
            m_delEquation = _explicitFunction;
                enum_graphCycle = _graphCycle;
        }
コード例 #8
0
ファイル: Graph.cs プロジェクト: Daburu/Daburu-Tools
 /// <summary>
 /// Creates a graph of graph-A with a certain percentage influenced from graph-B
 /// </summary>
 /// <param name="_graphA"> The initial graph A </param>
 /// <param name="_graphB"> The influencing graph B </param>
 /// <param name="_fBInfluence"> The percentage of influenced from the influencing graph B </param>
 /// <param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Returns a graph that mixed the two graphs together </returns>
 public static Graph Mix(Graph _graphA, Graph _graphB, float _fBInfluence, GraphCycle _enumGraphCycle)
 {
     return new Graph((float x) =>
         {
             return MixAsFloat(_graphA, _graphB, _fBInfluence, x);
         }, _enumGraphCycle);
 }
コード例 #9
0
ファイル: Graph.cs プロジェクト: Daburu/Daburu-Tools
 /// <summary>
 /// Creates a graph from the average of graph-A and graph-B
 /// </summary>
 /// <param name="_graphA"> The first graph </param>
 /// <param name="_graphB"> The second graph </param>
 /// <param name="_enumGraphCycle"> The graph cycle type of the graph </param>
 /// <returns> Returns the average of both graph </returns>
 public static Graph Average(Graph _graphA, Graph _graphB, GraphCycle _enumGraphCycle)
 {
     return new Graph((float x) =>
         {
             return AverageAsFloat(_graphA, _graphB, x);
         }, _enumGraphCycle);
 }
コード例 #10
0
 /// <summary>
 /// Create a parametric graph instance
 /// </summary>
 /// <param name="_explicitFunction"> The delegate that contains a parametric graph equation </param>
 public Graph(ExplicitFunction _explicitFunction)
 {
     m_delEquation   = _explicitFunction;
     enum_graphCycle = GraphCycle.None;
 }
コード例 #11
0
        private ExplicitFunction m_delEquation;                    // m_delEquation: The delegate to store the graph function

        // Constructors
        public Graph(ExplicitFunction _explicitFunction, GraphCycle _graphCycle)
        {
            m_delEquation   = _explicitFunction;
            enum_graphCycle = _graphCycle;
        }
コード例 #12
0
 private void Сброс_Click(object sender, EventArgs e)
 {
     g.Clear(Color.White);
     GraphCycle.Refresh();
 }
コード例 #13
0
 void drawLine(int x1, int y1, int x2, int y2)
 {
     g.DrawLine(p, x1, y1, x2, y2);
     Thread.Sleep(20);
     GraphCycle.Refresh();
 }