示例#1
0
        public GraphExample Graph_Setup(string FOCUS = "")
        {
            if (Produit.GrandeurPhysiques == null)
                return null;

            var dataGraph = new GraphExample();
            if (FOCUS == "FOCUS")
            {
                foreach (var GP in Produit.GrandeurPhysiques)
                {
                    if (GP.Value.Selectionne)
                    {
                        var dataVertex = new DataVertex(GP.Key);
                        dataGraph.AddVertex(dataVertex);
                    }
                }  
            }
            else
            {
              foreach (var GP in Produit.GrandeurPhysiques)
                {
                    //if (GP.Value.EstPremier)
                    //{
                        var dataVertex = new DataVertex(GP.Key);
                        dataGraph.AddVertex(dataVertex);
                    //}
                }  
            }
            
            //Now lets make some edges that will connect our vertices
            //get the indexed list of graph vertices we have already added
            var vlist = dataGraph.Vertices.ToList();
            var dataEdge = new DataEdge(); //= new DataEdge(vlist[0], vlist[1]);
            //dataGraph.AddEdge(dataEdge);
            foreach (var R1 in vlist)
            {
                foreach (var R2 in vlist)
                {
                    if (Relation.MatriceRelations[Produit.GrandeurPhysiques[R1.Text].iM][
                            Produit.GrandeurPhysiques[R2.Text].iM] != null)
                        if (Relation.MatriceRelations[Produit.GrandeurPhysiques[R1.Text].iM][
                            Produit.GrandeurPhysiques[R2.Text].iM] !=1 -1)
                            {
                                dataEdge = new DataEdge(R1, R2);
                                dataGraph.AddEdge(dataEdge);
                            }
               }
            }

            return dataGraph;
        }
示例#2
0
        private GraphExample Graph_Setup_old()
        {
            //Lets make new data graph instance
            var dataGraph = new GraphExample();

            //Now we need to create edges and vertices to fill data graph
            //This edges and vertices will represent graph structure and connections
            //Lets make some vertices
            for (int i = 1; i < 10; i++)
            {
                //Create new vertex with specified Text. Also we will assign custom unique ID.
                //This ID is needed for several features such as serialization and edge routing algorithms.
                //If you don't need any custom IDs and you are using automatic Area.GenerateGraph() method then you can skip ID assignment
                //because specified method automaticaly assigns missing data ids (this behavior controlled by method param).
                var dataVertex = new DataVertex("MyVertex " + i);
                //Add vertex to data graph
                dataGraph.AddVertex(dataVertex);
            }

            //Now lets make some edges that will connect our vertices
            //get the indexed list of graph vertices we have already added
            var vlist = dataGraph.Vertices.ToList();
            //Then create two edges optionaly defining Text property to show who are connected
            var dataEdge = new DataEdge(vlist[0], vlist[1])
            {
                Text = string.Format("{0} -> {1}", vlist[0], vlist[1])
            };

            dataGraph.AddEdge(dataEdge);
            dataEdge = new DataEdge(vlist[2], vlist[3])
            {
                Text = string.Format("{0} -> {1}", vlist[2], vlist[3])
            };
            dataGraph.AddEdge(dataEdge);

            return(dataGraph);
        }
        private GraphExample Graph_Setup_old()
        {
            //Lets make new data graph instance
            var dataGraph = new GraphExample();
            //Now we need to create edges and vertices to fill data graph
            //This edges and vertices will represent graph structure and connections
            //Lets make some vertices
            for (int i = 1; i < 10; i++)
            {
                //Create new vertex with specified Text. Also we will assign custom unique ID.
                //This ID is needed for several features such as serialization and edge routing algorithms.
                //If you don't need any custom IDs and you are using automatic Area.GenerateGraph() method then you can skip ID assignment
                //because specified method automaticaly assigns missing data ids (this behavior controlled by method param).
                var dataVertex = new DataVertex("MyVertex " + i);
                //Add vertex to data graph
                dataGraph.AddVertex(dataVertex);
            }

            //Now lets make some edges that will connect our vertices
            //get the indexed list of graph vertices we have already added
            var vlist = dataGraph.Vertices.ToList();
            //Then create two edges optionaly defining Text property to show who are connected
            var dataEdge = new DataEdge(vlist[0], vlist[1]) { Text = string.Format("{0} -> {1}", vlist[0], vlist[1]) };
            dataGraph.AddEdge(dataEdge);
            dataEdge = new DataEdge(vlist[2], vlist[3]) { Text = string.Format("{0} -> {1}", vlist[2], vlist[3]) };
            dataGraph.AddEdge(dataEdge);

            return dataGraph;
        }
示例#4
0
        public GraphExample Graph_Setup(string FOCUS = "")
        {
            if (Produit.GrandeurPhysiques == null)
            {
                return(null);
            }

            var dataGraph = new GraphExample();

            if (FOCUS == "FOCUS")
            {
                foreach (var GP in Produit.GrandeurPhysiques)
                {
                    if (GP.Value.Selectionne)
                    {
                        var dataVertex = new DataVertex(GP.Key);
                        dataGraph.AddVertex(dataVertex);
                    }
                }
            }
            else if (FOCUS == "ENSEMBLE")
            {
                foreach (var GP in Produit.GrandeurPhysiques)
                {
                    var dataVertex = new DataVertex(GP.Key);
                    dataGraph.AddVertex(dataVertex);
                }
            }
            else
            {
                foreach (var GP in Produit.GrandeurPhysiques)
                {
                    if (GP.Value.EstPremier)
                    {
                        var dataVertex = new DataVertex(GP.Key);
                        dataGraph.AddVertex(dataVertex);
                    }
                }
            }

            //Now lets make some edges that will connect our vertices
            //get the indexed list of graph vertices we have already added
            var vlist    = dataGraph.Vertices.ToList();
            var dataEdge = new DataEdge(); //= new DataEdge(vlist[0], vlist[1]);

            //dataGraph.AddEdge(dataEdge);
            foreach (var R1 in vlist)
            {
                foreach (var R2 in vlist)
                {
                    if (Relation.MatriceRelations[Produit.GrandeurPhysiques[R1.Text].iM][
                            Produit.GrandeurPhysiques[R2.Text].iM] != null)
                    {
                        if (Relation.MatriceRelations[Produit.GrandeurPhysiques[R1.Text].iM][
                                Produit.GrandeurPhysiques[R2.Text].iM] != 1 - 1)
                        {
                            dataEdge = new DataEdge(R1, R2);
                            dataGraph.AddEdge(dataEdge);
                        }
                    }
                }
            }

            return(dataGraph);
        }