public void ReturnMultiVisitedNodes()
        {
            ///test that method will return ordered list of visited nodes
            Graphs graph  = new Graphs();
            Node   testV1 = new Node("Test1");
            Node   testV2 = new Node("Test2");
            Node   testV3 = new Node("Test3");

            graph.AddNode(testV1);
            graph.AddNode(testV2);
            graph.AddNode(testV3);
            graph.AddEdge(testV1, testV2, 4);
            graph.AddEdge(testV2, testV3, 8);
            List <Node> expected = new List <Node>();

            expected.Add(testV3);
            expected.Add(testV2);
            Assert.Equal(expected, graph.BreadFirst(testV3));
        }
Exemplo n.º 2
0
        public void AddSingleGraph(string name, Color color, BasicFunction xFunc, BasicFunction yFunc,
                                   string xAxis, string yAxis)
        {
            var gu       = new GraphUnderlying(xAxis, yAxis);
            var timeline = new Timeline(name, color);

            gu.AddTimeline(timeline);
            Graph graph = new Graph(gu);

            void function(DataSource ds)
            {
                ds.AddData(xFunc());
                ds.AddData(yFunc());
            }

            updatingCollection.AddContainer(new UpdatingContainer(gu, function));
            updatingFunctions.AddFunction(function);
            Graphs.AddGraph(graph);
        }
        public override void InitTask()
        {
            var player     = CreatePlayer();
            var toolConfig = new ToolConfig(typeof(LayoutTool), new ToolParams());

            player.SetupParams(new PlayerParameters(new Vector3(0, 0, -1050), Vector3.zero, SceneParametersContainer.PlayerSpeed, 20, sceneInfo: "Social interactions", isVR: SceneParametersContainer.IsVR, toolConfigs: new[] { toolConfig }));
            {
                var graph          = new GameObject("Social interactions");
                var graphControler = graph.AddComponent <GraphForBillboardVertexes>();
                Graphs.Add(graphControler);
                var edges = new List <AdjacencyListBaseGenerator.AdjacencyInfo>(5000);

                const int vertCount  = 500;
                const int sibCount   = 10;
                const int enemyCount = 2;
                for (var i = 0; i < vertCount; ++i)
                {
                    for (var j = 0; j < Random.Range(0, sibCount + 1); ++j)
                    {
                        var sibId = Random.Range(0, vertCount);
                        while (sibId == i)
                        {
                            sibId = Random.Range(0, vertCount);
                        }
                        edges.Add(new AdjacencyListBaseGenerator.AdjacencyInfo(i.ToString(), sibId.ToString(), true, 100, 10, Color.blue));
                    }

                    for (var j = 0; j < Random.Range(0, enemyCount + 1); ++j)
                    {
                        var sibId = Random.Range(0, vertCount);
                        while (sibId == i)
                        {
                            sibId = Random.Range(0, vertCount);
                        }
                        edges.Add(new AdjacencyListBaseGenerator.AdjacencyInfo(i.ToString(), sibId.ToString(), true, 1000, 15, Color.red));
                    }
                }
                graphControler.SetupParams(new GraphParameters(Vector3.zero, "Social interactions"));
                var generator = new AdjacencyListBaseGenerator(edges, new RandomPlaceholder(Vector3.one * -2300, Vector3.one * 2300), null, 15);
                generator.Generate(graphControler);
            }
        }
Exemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            Program.FORM.listBoxMatrix.Items.Clear();

            AMatrix = new int[V.Count, V.Count];
            G.fillAdjacencyMatrix(V.Count, E, AMatrix);
            SqMatrix M = new SqMatrix(AMatrix);

            g = new Graphs(M);

            //g.ShowInfoFile();

            FileStream   fs  = new FileStream("Информация о графе.txt", FileMode.Create);
            TextWriter   tmp = Console.Out;
            StreamWriter sw  = new StreamWriter(fs);

            Console.SetOut(sw);

            //Polynom pol = g.Xpolymon();
            //Console.Write("Хроматический полином: "); pol.Show();
            //Console.WriteLine("Тогда хроматическое число X = {0}", g.ChromaticNumber);
            g.ShowCheck0();
            try
            {
                g.ShowCheck11();
            }
            catch (Exception y) { Console.Write("----------Исключение! "); Console.WriteLine(y.Message); }

            sw.Close();
            Console.SetOut(tmp);
            Console.WriteLine("Запись завершена!");

            StreamReader sr = new StreamReader("Информация о графе.txt");
            string       s  = "";

            while (s != null)
            {
                listBoxMatrix.Items.Add(s);
                s = sr.ReadLine();
            }
            sr.Close();
        }
Exemplo n.º 5
0
        private void Convert(UnitConverter converter)
        {
            var toConvert = m_Data.Where(d => Array.IndexOf(converter.getConvertableUnits(), m_Units[d.Key]) >= 0).ToArray();

            foreach (var keyValue in toConvert)
            {
                string newUnit = converter.Convert(m_Data[keyValue.Key], m_Units[keyValue.Key]);

                var toUpdateX = Graphs.Where(graph => graph.XAxis != null && string.Equals(graph.XAxis, keyValue.Key));
                var toUpdateY = Graphs.Where(graph => graph.YAxis != null && string.Equals(graph.YAxis, keyValue.Key));
                foreach (Graph graph in toUpdateX)
                {
                    graph.X_Unit = newUnit;
                    for (int i = 0; i < m_DataSize; i++)
                    {
                        graph.PointPairs[i].X = m_Data[keyValue.Key][i];
                    }
                }
                foreach (Graph graph in toUpdateY)
                {
                    graph.Y_Unit = newUnit;
                    for (int i = 0; i < m_DataSize; i++)
                    {
                        graph.PointPairs[i].Y = m_Data[keyValue.Key][i];
                    }
                }

                m_Units[keyValue.Key] = newUnit;
            }

            Redraw();
            var visibleColumns = DataGrid.Columns
                                 .Where(c => c.Visibility == System.Windows.Visibility.Visible)
                                 .Select(s => s.Header.ToString().Split(",".ToCharArray())[0])
                                 .ToList();

            UpdateDataGrid();
            foreach (var columnName in visibleColumns)
            {
                ShowColumn(columnName);
            }
        }
    public override void CreateGraph()
    {
        Console.WriteLine("Directed Graph Generator\n");
        Console.Write("Enter the number of vertices: ");

        int numberOfVertices = Int32.Parse(Console.ReadLine());

        int [,] graph = new int[numberOfVertices, numberOfVertices];

        for (int line = 0; line < graph.GetLength(0); line++)
        {
            for (int column = 0; column < graph.GetLength(1); column++)
            {
                graph[line, column] = new Random().Next(2);
            }
        }
        Console.WriteLine(GetLayoutGraph(graph));

        Graphs.Add(new NewDirectedGraph());
    }
Exemplo n.º 7
0
        public void BuildGraph(string x, string y)
        {
            if (m_Data.Count == 0)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(x))
            {
                var   points = new PointPairList(new double[m_DataSize], m_Data[y].ToArray());
                Graph graph  = new Graph(points, y + "(" + x + ")", x, y, null, m_Units[y]);
                Graphs.Add(graph);
            }
            else if (m_Data.ContainsKey(x) && m_Data.ContainsKey(y))
            {
                var   points = new PointPairList(m_Data[x].ToArray(), m_Data[y].ToArray());
                Graph graph  = new Graph(points, y + "(" + x + ")", x, y, m_Units[x], m_Units[y]);
                Graphs.Add(graph);
            }
        }
Exemplo n.º 8
0
 private void ReadGraphsFromFile()
 {
     Logger.LogInformation("Reading graphs from file...");
     foreach (string file in Files)
     {
         try
         {
             if (!Graphs.ContainsKey(file))
             {
                 Logger.LogDebug($" - loading '{file}'...");
                 Graphs.Add(file, ReadGraphFromFile(file));
             }
         }
         catch (Exception exception)
         {
             Logger.LogWarning($" ! Error while parsing '{file}': {exception.Message}");
         }
     }
     Logger.LogInformation("Done reading graphs from file.\n");
 }
Exemplo n.º 9
0
        public static Graphs OpenGraph(string filename)
        {
            FileStream   stream       = new FileStream(filename, FileMode.Open);
            BinaryReader binaryReader = new BinaryReader(stream);
            Graphs       graph        = new Graphs();
            int          n            = binaryReader.ReadInt32();

            for (int i = 0; i < n; i++)
            {
                graph.AddNode(binaryReader.ReadInt32(), binaryReader.ReadInt32());
            }
            n = binaryReader.ReadInt32();
            for (int i = 0; i < n; i++)
            {
                graph.AddEdge(graph.Nodes[binaryReader.ReadInt32()], graph.Nodes[binaryReader.ReadInt32()]);
            }
            binaryReader.Close();
            stream.Close();
            return(graph);
        }
Exemplo n.º 10
0
        //кнопка - удалить граф
        private void deleteALLButton_Click(object sender, EventArgs e)
        {
            selectButton.Enabled     = true;
            drawVertexButton.Enabled = true;
            drawEdgeButton.Enabled   = true;
            deleteButton.Enabled     = true;
            const string message = "Вы действительно хотите полностью удалить граф?";
            const string caption = "Удаление";
            var          MBSave  = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (MBSave == DialogResult.Yes)
            {
                V.Clear();
                E.Clear();
                G.clearSheet();
                sheet.Image = G.GetBitmap();
                g           = new Graphs(0);
            }
            listBoxMatrix.Items.Clear();
            save = false;
        }
        public void RetreiveSingleNodeandEdge()
        {
            ///Test that a single vertex and edge can be found
            Graphs graph  = new Graphs();
            Node   testV1 = new Node("Test1");

            graph.AddNode(testV1);
            graph.AddEdge(testV1, testV1, 4);
            Edge        testEdge = new Edge(testV1, testV1, 4);
            List <Node> expected = new List <Node>();

            expected.Add(testEdge.V1);
            List <Edge> graphEdges = graph.GetNeighbors(testV1);
            List <Node> actual     = new List <Node>();

            foreach (Edge e in graphEdges)
            {
                actual.Add(e.V1);
            }
            Assert.Equal(expected, actual);
        }
        public void RetreiveWeightNeighbors()
        {
            ///Test that all weight can be retrieved from neighbors
            Graphs graph  = new Graphs();
            Node   testV1 = new Node("Test1");
            Node   testV2 = new Node("Test2");

            graph.AddNode(testV1);
            graph.AddNode(testV2);
            graph.AddEdge(testV1, testV2, 4);
            Edge        testEdge   = new Edge(testV1, testV2, 4);
            List <Edge> graphEdges = graph.GetNeighbors(testV2);
            int         weight     = 0;

            foreach (Edge e in graphEdges)
            {
                weight = e.Weight;
            }

            Assert.Equal(testEdge.Weight, weight);
        }
Exemplo n.º 13
0
        public void Start()
        {
            if (!IConfigurationStore.GetByType <WebPageConfig>().EnableLoadPage)
            {
                return;
            }

            AppDomain.CurrentDomain.FirstChanceException += OnException;

            GenerateGraphs();

            this.Page = IGraphPage.Create(Graphs.ToArray(), "System Load Information", IConfigurationStore.GetByType <WebPageConfig>().LoadPageHandle, IConfigurationStore.GetByType <WebPageConfig>().LoadPageWidth);

            var tmr = new System.Timers.Timer(IConfigurationStore.GetByType <WebPageConfig>().LoadPageIntervalSeconds * 1000)
            {
                AutoReset = true
            };

            tmr.Elapsed += Tick;
            tmr.Start();
        }
Exemplo n.º 14
0
        public static void SaveGraph(string filename, Graphs graph)
        {
            FileStream   stream       = new FileStream(filename, FileMode.CreateNew);
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            binaryWriter.Write(graph.Nodes.Count);
            for (int i = 0; i < graph.Nodes.Count; i++)
            {
                binaryWriter.Write(graph.Nodes[i].x);
                binaryWriter.Write(graph.Nodes[i].y);
            }
            binaryWriter.Write(graph.Edges.Count);
            for (int i = 0; i < graph.Edges.Count; i++)
            {
                binaryWriter.Write(FindInd(graph.Edges[i].first.x, graph.Edges[i].first.y, graph));
                binaryWriter.Write(FindInd(graph.Edges[i].second.x, graph.Edges[i].second.y, graph));
            }
            binaryWriter.Flush();
            binaryWriter.Close();
            stream.Close();
        }
        /// <summary>
        /// Updates visualization
        /// </summary>
        private async Task UpdateVisualAsync()
        {
            double timeOfLastDraw = 0;

            while (await turnBuffer.OutputAvailableAsync() && IsRunning)
            {
                var turn = turnBuffer.Receive();
                // Process commands
                turn.Commands.ProcessAll(Visualizer);
                // Redraw screen
                //InvalidateVisual();

                //Update time display
                DisplayTime = turn.Time;
                UpdateTime(DisplayTime);

                // Update graphs
                Graphs.Update(turn.Data);

                if (!FastDraw)
                {
                    //Check if delay is needed
                    var timeDiff = DisplayTime / TimeScale - timer.Elapsed.TotalSeconds;
                    if (timeDiff > 0)
                    {
                        // This delays it so the clocks will line up
                        int delay = (int)(timeDiff * 1000); // Convert to milliseconds
                        await Task.Delay(delay);
                    }
                }

                double timeSinceLastDraw = timer.Elapsed.TotalSeconds - timeOfLastDraw;
                if (timeSinceLastDraw > FlushTime || SlowDraw)
                {
                    InvalidateVisual();
                    WaitForDrawing();
                    timeOfLastDraw = timer.Elapsed.TotalSeconds;
                }
            }
        }
Exemplo n.º 16
0
        public void AllPaths()
        {
            Graphs_Graph graph = new Graphs_Graph();

            graph.AddNode(0);
            graph.AddNode(1);
            graph.AddNode(2);
            graph.AddNode(3);

            graph.AddEdge(0, 2);
            graph.AddEdge(2, 0);
            graph.AddEdge(0, 3);
            graph.AddEdge(0, 1);
            graph.AddEdge(2, 1);
            graph.AddEdge(1, 3);

            Graphs graphs = new Graphs(graph);

            graphs.AllPaths(2, 3);

            Assert.Equal(3, graphs.Result.Count);
        }
Exemplo n.º 17
0
        public void IsTherePath()
        {
            Graphs_Graph graph = new Graphs_Graph();

            graph.AddNode(0);
            graph.AddNode(1);
            graph.AddNode(2);
            graph.AddNode(3);

            graph.AddEdge(0, 2);
            graph.AddEdge(2, 0);
            graph.AddEdge(0, 1);
            graph.AddEdge(1, 2);
            graph.AddEdge(1, 2);
            graph.AddEdge(2, 3);
            graph.AddEdge(3, 3);

            Graphs graphs = new Graphs(graph);

            Assert.Equal(true, graphs.IsTherePath(1, 3));
            Assert.Equal(false, graphs.IsTherePath(3, 1));
        }
Exemplo n.º 18
0
        private void расположитьВершиныНаОкружностиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AMatrix = new int[V.Count, V.Count];
            G.fillAdjacencyMatrix(V.Count, E, AMatrix);
            selectButton.Enabled     = true;
            drawVertexButton.Enabled = true;
            drawEdgeButton.Enabled   = true;
            deleteButton.Enabled     = true;
            //Vtmp = new List<Vertex>(V);
            //Etmp = new List<Edge>(E);
            V.Clear();
            E.Clear();
            G.clearSheet();
            sheet.Image = G.GetBitmap();

            SqMatrix M = new SqMatrix(AMatrix);

            g      = new Graphs(M);
            this.V = new List <Vertex>(g.Ver);
            this.E = new List <Edge>(g.Ed);
            G.drawThisGraph(g);
        }
        /// <summary>
        /// Gets the edges.
        /// </summary>
        /// <param name="trip">The trip.</param>
        /// <param name="flights">The flights.</param>
        /// <returns>Returns a string</returns>
        public static string GetEdges(Node[] trip, Graphs flights)
        {
            int  cost  = 0;
            bool check = false;

            for (int i = 0; i < trip.Length - 1; i++)
            {
                if (flights.GetNeighbors(trip[i]).Contains(trip[i + 1]))
                {
                    check = true;
                    var item = flights.AdjacencyList.GetValueOrDefault(trip[i]);
                    foreach (var value in item)
                    {
                        if (value.Item1 == trip[i + 1])
                        {
                            cost += value.Item2;
                        }
                    }
                }
            }
            return($"{check} ${cost}");
        }
Exemplo n.º 20
0
    public void ForceUpdate()
    {
        PathGraphMap.Clear();
        string savePath = GetSavePath();

        if (savePath[savePath.Length - 1] == '/')
        {
            savePath = savePath.Substring(0, savePath.Length - 1);
        }
        var guids = AssetDatabase.FindAssets($"t:{typeof(T).FullName}", new string[] { savePath });

        foreach (var guid in guids)
        {
            string path  = AssetDatabase.GUIDToAssetPath(guid);
            T      graph = AssetDatabase.LoadAssetAtPath <T>(path);
            if (graph != null)
            {
                PathGraphMap.Add(path, graph);
            }
        }
        Names = Graphs.Select(it => it.name).ToList();
    }
Exemplo n.º 21
0
        public void Process(CompleteTurn turn)
        {
            try
            {
                turn.Graphics.DoTurns(arena.Display);
                Graphs.Update(turn.Statistics);

                InvalidateVisual();
                arena.InvalidateVisual();
                Graphs.InvalidateVisual();

                if (SlowDraw)
                {
                    // This forces it to wait until the drawing is complete
                    Dispatcher.Invoke(delegate { }, DispatcherPriority.ContextIdle);
                }
            }
            catch (Exception)
            {
                // Do nothing
            }
        }
Exemplo n.º 22
0
        protected Graph <String, DefaultWeightedEdge> createWithBias(bool negate)
        {
            Graph <String, DefaultWeightedEdge> g;
            double bias = 1;

            if (negate)
            {
                // negative-weight edges are being tested, so only a directed graph
                // makes sense
                g    = new SimpleDirectedWeightedGraph <string, DefaultWeightedEdge>(typeof(DefaultWeightedEdge));
                bias = 1;
            }
            else
            {
                // by default, use an undirected graph
                g = new SimpleWeightedGraph <string, DefaultWeightedEdge>(typeof(DefaultWeightedEdge));
            }

            g.addVertex(V1);
            g.addVertex(V2);
            g.addVertex(V3);
            g.addVertex(V4);
            g.addVertex(V5);

            e12 = Graphs.addEdge(g, V1, V2, bias * 2);

            e13 = Graphs.addEdge(g, V1, V3, bias * 3);

            e24 = Graphs.addEdge(g, V2, V4, bias * 5);

            e34 = Graphs.addEdge(g, V3, V4, bias * 20);

            e45 = Graphs.addEdge(g, V4, V5, bias * 5);

            e15 = Graphs.addEdge(g, V1, V5, bias * 100);

            return(g);
        }
Exemplo n.º 23
0
        private void OnGraphsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (SerialGraph graph in e.OldItems)
                {
                    RemoveGraphFromCanvas(graph);
                    RemoveIndicator(graph);
                }
            }

            if (e.NewItems != null)
            {
                foreach (SerialGraph graph in e.NewItems)
                {
                    if (graph.Brush == null && PresetBrushes.Count > 0)
                    {
                        graph.Brush = PresetBrushes[Graphs.IndexOf(graph) % PresetBrushes.Count];
                    }
                    AddGraphToCanvas(graph);
                    AddIndicator(graph);
                }
            }
        }
Exemplo n.º 24
0
        private void нарисоватьДополнениеГрафаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AMatrix = new int[V.Count, V.Count];
            G.fillAdjacencyMatrix(V.Count, E, AMatrix);
            selectButton.Enabled     = true;
            drawVertexButton.Enabled = true;
            drawEdgeButton.Enabled   = true;
            deleteButton.Enabled     = true;
            //Vtmp = new List<Vertex>(V);
            //Etmp = new List<Edge>(E);
            V.Clear();
            E.Clear();
            G.clearSheet();
            sheet.Image = G.GetBitmap();

            SqMatrix M = new SqMatrix(AMatrix);

            g = new Graphs(M);
            Graphs dg = g.Addition;

            this.V = new List <Vertex>(g.Ver);
            this.E = new List <Edge>(g.Ed);
            G.drawThisGraph(dg);
        }
Exemplo n.º 25
0
        private void button6_Click(object sender, EventArgs e)
        {
            Program.FORM.listBoxMatrix.Items.Clear();

            AMatrix = new int[V.Count, V.Count];
            G.fillAdjacencyMatrix(V.Count, E, AMatrix);
            SqMatrix M = new SqMatrix(AMatrix);

            g = new Graphs(M);

            //g.ShowInfoFile();

            FileStream   fs  = new FileStream("Информация о графе.txt", FileMode.Create);
            TextWriter   tmp = Console.Out;
            StreamWriter sw  = new StreamWriter(fs);

            Console.SetOut(sw);

            g.ShowCheck0();
            try { g.ShowCheck5(); }
            catch (Exception y) { Console.WriteLine(y.Message); }

            sw.Close();
            Console.SetOut(tmp);
            Console.WriteLine("Запись завершена!");

            StreamReader sr = new StreamReader("Информация о графе.txt");
            string       s  = "";

            while (s != null)
            {
                listBoxMatrix.Items.Add(s);
                s = sr.ReadLine();
            }
            sr.Close();
        }
        public void CanFindNoDirectFlight()
        {
            Node   Pandora      = new Node("Pandora");
            Node   Arendelle    = new Node("Arendelle");
            Node   Metroville   = new Node("Metroville");
            Node   Monstropolis = new Node("Monstropolis");
            Node   Narnia       = new Node("Narnia");
            Node   Naboo        = new Node("Naboo");
            Graphs flights      = new Graphs(Metroville);

            flights.AddEdge(Metroville, new Tuple <Node, int>(Narnia, 37));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Naboo, 26));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Monstropolis, 105));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Arendelle, 99));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Pandora, 82));
            flights.AddEdge(Pandora, new Tuple <Node, int>(Arendelle, 150));
            flights.AddEdge(Arendelle, new Tuple <Node, int>(Monstropolis, 42));
            flights.AddEdge(Monstropolis, new Tuple <Node, int>(Naboo, 73));
            flights.AddEdge(Naboo, new Tuple <Node, int>(Narnia, 250));

            Node[] trip3 = new Node[] { Naboo, Pandora };

            Assert.Equal("False $0", GetEdges(trip3, flights));
        }
        public void CanFindDirectFlightMultipleLayovers()
        {
            Node   Pandora      = new Node("Pandora");
            Node   Arendelle    = new Node("Arendelle");
            Node   Metroville   = new Node("Metroville");
            Node   Monstropolis = new Node("Monstropolis");
            Node   Narnia       = new Node("Narnia");
            Node   Naboo        = new Node("Naboo");
            Graphs flights      = new Graphs(Metroville);

            flights.AddEdge(Metroville, new Tuple <Node, int>(Narnia, 37));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Naboo, 26));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Monstropolis, 105));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Arendelle, 99));
            flights.AddEdge(Metroville, new Tuple <Node, int>(Pandora, 82));
            flights.AddEdge(Pandora, new Tuple <Node, int>(Arendelle, 150));
            flights.AddEdge(Arendelle, new Tuple <Node, int>(Monstropolis, 42));
            flights.AddEdge(Monstropolis, new Tuple <Node, int>(Naboo, 73));
            flights.AddEdge(Naboo, new Tuple <Node, int>(Narnia, 250));

            Node[] trip2 = new Node[] { Narnia, Metroville, Arendelle };

            Assert.Equal("True $136", GetEdges(trip2, flights));
        }
Exemplo n.º 28
0
 /**
  * Adds all the vertices and all the edges of the {@code sourceGraph} to the graph being built.
  *
  * @param sourceGraph the source graph
  * @return this builder object
  *
  * @see Graphs#addGraph(Graph, Graph)
  */
 public B addGraph(Graph <V, E> sourceGraph)
 {
     Graphs.addGraph(this.graph, sourceGraph);
     return(this.self());
 }
Exemplo n.º 29
0
 /**
  * Adds an edge to the graph being built. The source and target vertices are added to the graph,
  * if not already included.
  *
  * @param source source vertex of the edge.
  * @param target target vertex of the edge.
  *
  * @return this builder object
  *
  * @see Graphs#addEdgeWithVertices(Graph, Object, Object)
  */
 public B addEdge(V source, V target)
 {
     Graphs.addEdgeWithVertices(this.graph, source, target);
     return(this.self());
 }
Exemplo n.º 30
0
        public GraphForBillboardVertexes CreateGraph()
        {
            var graph          = new GameObject("Graph");
            var graphControler = graph.AddComponent <GraphForBillboardVertexes>();
            var graphInfo      = new GraphSerializationInfo()
            {
                VertexInfos = new[]
                {
                    new VertexSerializationInfo(new Vector3(-513, -249.82499313354492f), 15, "Царство: Растения", Color.white),
                    new VertexSerializationInfo(new Vector3(130.5f, 35.92500686645508f), 15, "Отдел: Цветковые", Color.white),
                    new VertexSerializationInfo(new Vector3(523.5f, 270.4500045776367f), 15, "Класс: Двудольные", Color.white),
                    new VertexSerializationInfo(new Vector3(750, 384.4500045776367f), 15, "Порядок: Букоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(864, 492.4500045776367f), 15, "Семейство: Берёзовые", Color.white),
                    new VertexSerializationInfo(new Vector3(936, 618.4500045776367f), 15, "Род: Берёза", Color.white),
                    new VertexSerializationInfo(new Vector3(1107, 920.1750068664551f), 15, "Вид: Берёза бумажная", Color.white),
                    new VertexSerializationInfo(new Vector3(1118.25f, 740.1750068664551f), 15, "Вид: Берёза вишнёвая", Color.white),
                    new VertexSerializationInfo(new Vector3(1102.5f, 695.1750068664551f), 15, "Вид: Берёза даурская", Color.white),
                    new VertexSerializationInfo(new Vector3(1091.25f, 656.9250068664551f), 15, "Вид: Берёза карликовая", Color.white),
                    new VertexSerializationInfo(new Vector3(1113.75f, 872.9250068664551f), 15, "Вид: Берёза Максимовича", Color.white),
                    new VertexSerializationInfo(new Vector3(1118.25f, 834.6750068664551f), 15, "Вид: Берёза мелколистная", Color.white),
                    new VertexSerializationInfo(new Vector3(1120.5f, 791.9250068664551f), 15, "Вид: Берёза плосколистная", Color.white),
                    new VertexSerializationInfo(new Vector3(1084.5f, 618.6750068664551f), 15, "Вид: Берёза повислая", Color.white),
                    new VertexSerializationInfo(new Vector3(1044, 589.4250068664551f), 15, "Вид: Берёза пушистая", Color.white),
                    new VertexSerializationInfo(new Vector3(1095.75f, 962.9250068664551f), 15, "Вид: Берёза Радде", Color.white),
                    new VertexSerializationInfo(new Vector3(1037.25f, 553.4250068664551f), 15, "Вид: Берёза ребристая", Color.white),
                    new VertexSerializationInfo(new Vector3(1073.25f, 994.4250068664551f), 15, "Вид: Берёза шаровидносерёжковая", Color.white),
                    new VertexSerializationInfo(new Vector3(1041.75f, 1032.675006866455f), 15, "Вид: Берёза шерстистая", Color.white),
                    new VertexSerializationInfo(new Vector3(1003.5f, 1070.925006866455f), 15, "Вид: Берёза Шмидта", Color.white),
                    new VertexSerializationInfo(new Vector3(565.5f, 729.4500045776367f), 15, "Вид: Бересклет бородавчатый", Color.white),
                    new VertexSerializationInfo(new Vector3(517.5f, 388.9500045776367f), 15, "Порядок: Бересклетоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(513, 489.4500045776367f), 15, "Семейство: Бересклетовые", Color.white),
                    new VertexSerializationInfo(new Vector3(526.5f, 621.4500045776367f), 15, "Род: Бересклет", Color.white),
                    new VertexSerializationInfo(new Vector3(166.5f, 390.4500045776367f), 15, "Порядок: Розоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(307.5f, 486.4500045776367f), 15, "Семейство: Розовые", Color.white),
                    new VertexSerializationInfo(new Vector3(271.5f, 609.4500045776367f), 15, "Род: Боярышник", Color.white),
                    new VertexSerializationInfo(new Vector3(285, 727.9500045776367f), 15, "Вид: Боярышник кроваво-красный", Color.white),
                    new VertexSerializationInfo(new Vector3(10.5f, 601.9500045776367f), 15, "Род: Слива", Color.white),
                    new VertexSerializationInfo(new Vector3(-1.5f, 727.9500045776367f), 15, "Вид: Вишня обыкновенная", Color.white),
                    new VertexSerializationInfo(new Vector3(46.5f, 801.4500045776367f), 15, "Вид: Вишня сахалинская", Color.white),
                    new VertexSerializationInfo(new Vector3(-88.5f, 480.4500045776367f), 15, "Семейство: Вязовые", Color.white),
                    new VertexSerializationInfo(new Vector3(-181.5f, 595.9500045776367f), 15, "Род: Вяз", Color.white),
                    new VertexSerializationInfo(new Vector3(-240, 723.4500045776367f), 15, "Вид: Вяз гладкий", Color.white),
                    new VertexSerializationInfo(new Vector3(-193.5f, 774.4500045776367f), 15, "Вид: Вяз крупноплодный", Color.white),
                    new VertexSerializationInfo(new Vector3(-150, 811.9500045776367f), 15, "Вид: Вяз малый", Color.white),
                    new VertexSerializationInfo(new Vector3(-252, 841.9500045776367f), 15, "Вид: Вяз приземистый", Color.white),
                    new VertexSerializationInfo(new Vector3(-109.5f, 861.4500045776367f), 15, "Вид: Вяз разрезной", Color.white),
                    new VertexSerializationInfo(new Vector3(-237, 898.9500045776367f), 15, "Вид: Вяз шершавый", Color.white),
                    new VertexSerializationInfo(new Vector3(-265.5f, 678.4500045776367f), 15, "Вид: Вяз эллиптический", Color.white),
                    new VertexSerializationInfo(new Vector3(874.125f, 639.8250045776367f), 15, "Род: Граб", Color.white),
                    new VertexSerializationInfo(new Vector3(910.125f, 759.8250045776367f), 15, "Вид: Граб обыкновенный", Color.white),
                    new VertexSerializationInfo(new Vector3(394.5f, 615.4500045776367f), 15, "Род: Груша", Color.white),
                    new VertexSerializationInfo(new Vector3(412.5f, 777.4500045776367f), 15, "Вид: Груша иволистная", Color.white),
                    new VertexSerializationInfo(new Vector3(468, 846.4500045776367f), 15, "Вид: Груша лохолистная", Color.white),
                    new VertexSerializationInfo(new Vector3(358.5f, 813.4500045776367f), 15, "Вид: Груша обыкновенная", Color.white),
                    new VertexSerializationInfo(new Vector3(706.5f, 508.9500045776367f), 15, "Семейство: Буковые", Color.white),
                    new VertexSerializationInfo(new Vector3(688.5f, 624.4500045776367f), 15, "Род: Дуб", Color.white),
                    new VertexSerializationInfo(new Vector3(714, 777.4500045776367f), 15, "Вид: Дуб зубчатый", Color.white),
                    new VertexSerializationInfo(new Vector3(771, 814.9500045776367f), 15, "Вид: Дуб крупнопыльниковый", Color.white),
                    new VertexSerializationInfo(new Vector3(675, 847.9500045776367f), 15, "Вид: Дуб монгольский", Color.white),
                    new VertexSerializationInfo(new Vector3(624, 793.9500045776367f), 15, "Вид: Дуб скальный", Color.white),
                    new VertexSerializationInfo(new Vector3(838.5f, 870.4500045776367f), 15, "Вид: Дуб черешчатый", Color.white),
                    new VertexSerializationInfo(new Vector3(-877.5f, 26.925006866455078f), 15, "Отдел: Хвойные", Color.white),
                    new VertexSerializationInfo(new Vector3(-1091.25f, 211.42500686645508f), 15, "Класс: Хвойные", Color.white),
                    new VertexSerializationInfo(new Vector3(-1012.5f, 359.9250068664551f), 15, "Порядок: Сосновые", Color.white),
                    new VertexSerializationInfo(new Vector3(-1046.25f, 456.6750068664551f), 15, "Семейство: Сосновые", Color.white),
                    new VertexSerializationInfo(new Vector3(-1048.5f, 566.9250068664551f), 15, "Род: Ель", Color.white),
                    new VertexSerializationInfo(new Vector3(-1037.25f, 659.1750068664551f), 15, "Вид: Ель аянская", Color.white),
                    new VertexSerializationInfo(new Vector3(-987.75f, 690.6750068664551f), 15, "Вид: Ель Глена", Color.white),
                    new VertexSerializationInfo(new Vector3(-1104.75f, 726.6750068664551f), 15, "Вид: Ель корейская", Color.white),
                    new VertexSerializationInfo(new Vector3(-893.25f, 724.4250068664551f), 15, "Вид: Ель обыкновенная", Color.white),
                    new VertexSerializationInfo(new Vector3(-882, 670.4250068664551f), 15, "Вид: Ель сибирская", Color.white),
                    new VertexSerializationInfo(new Vector3(-994.5f, 760.4250068664551f), 15, "Вид: Ель финская", Color.white),
                    new VertexSerializationInfo(new Vector3(-180, 389.1750068664551f), 15, "Порядок: Мальпигиецветные", Color.white),
                    new VertexSerializationInfo(new Vector3(-319.5f, 476.9250068664551f), 15, "Семейство: Ивовые", Color.white),
                    new VertexSerializationInfo(new Vector3(-396, 584.9250068664551f), 15, "Род: ИваVector2.one*5,", Color.white),
                    new VertexSerializationInfo(new Vector3(-506.25f, 668.1750068664551f), 15, "Вид: Ива белая", Color.white),
                    new VertexSerializationInfo(new Vector3(-387, 632.1750068664551f), 15, "Вид: Ива волчниковая", Color.white),
                    new VertexSerializationInfo(new Vector3(-479.25f, 609.6750068664551f), 15, "Вид: Ива козья", Color.white),
                    new VertexSerializationInfo(new Vector3(-452.25f, 749.1750068664551f), 15, "Вид: Ива ломкая", Color.white),
                    new VertexSerializationInfo(new Vector3(-488.25f, 708.6750068664551f), 15, "Вид: Ива остролистная", Color.white),
                    new VertexSerializationInfo(new Vector3(-432, 377.9250068664551f), 15, "Порядок: Бобовоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(-517.5f, 467.9250068664551f), 15, "Семейство: Бобовые", Color.white),
                    new VertexSerializationInfo(new Vector3(-569.25f, 578.1750068664551f), 15, "Род: Карагана", Color.white),
                    new VertexSerializationInfo(new Vector3(-603, 632.1750068664551f), 15, "Вид: Карагана древовидная", Color.white),
                    new VertexSerializationInfo(new Vector3(-654.75f, 359.9250068664551f), 15, "Порядок: Кизилоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(-751.5f, 463.4250068664551f), 15, "Семейство: Кизиловые", Color.white),
                    new VertexSerializationInfo(new Vector3(-785.25f, 580.4250068664551f), 15, "Род: Кизил", Color.white),
                    new VertexSerializationInfo(new Vector3(-704.25f, 769.4250068664551f), 15, "Вид: Кизил спорный", Color.white),
                    new VertexSerializationInfo(new Vector3(1100.25f, 393.6750068664551f), 15, "Порядок: Сапиндоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(1237.5f, 488.1750068664551f), 15, "Семейство: Сапиндовые", Color.white),
                    new VertexSerializationInfo(new Vector3(1264.5f, 625.4250068664551f), 15, "Род: Клён", Color.white),
                    new VertexSerializationInfo(new Vector3(1330.125f, 722.3250045776367f), 15, "Вид: Клён бородатый", Color.white),
                    new VertexSerializationInfo(new Vector3(1327.125f, 767.3250045776367f), 15, "Вид: Клён жёлтый", Color.white),
                    new VertexSerializationInfo(new Vector3(1313.625f, 810.8250045776367f), 15, "Вид: Клён зеленокорый", Color.white),
                    new VertexSerializationInfo(new Vector3(1292.625f, 852.8250045776367f), 15, "Вид: Клён ложнозибольдов", Color.white),
                    new VertexSerializationInfo(new Vector3(1333.125f, 683.3250045776367f), 15, "Вид: Клён маньчжурский", Color.white),
                    new VertexSerializationInfo(new Vector3(1276.125f, 891.8250045776367f), 15, "Вид: Клён остролистный", Color.white),
                    new VertexSerializationInfo(new Vector3(1250.625f, 942.8250045776367f), 15, "Вид: Клён полевой", Color.white),
                    new VertexSerializationInfo(new Vector3(787.125f, 605.3250045776367f), 15, "Род: Лещина", Color.white),
                    new VertexSerializationInfo(new Vector3(827.625f, 672.8250045776367f), 15, "Вид: Лещина обыкновенная", Color.white),
                    new VertexSerializationInfo(new Vector3(1321.125f, 395.3250045776367f), 15, "Порядок: Мальвоцветные", Color.white),
                    new VertexSerializationInfo(new Vector3(1408.125f, 468.8250045776367f), 15, "Семейство: Мальвовые", Color.white),
                    new VertexSerializationInfo(new Vector3(1483.125f, 614.3250045776367f), 15, "Род: Липа", Color.white),
                    new VertexSerializationInfo(new Vector3(1538.625f, 647.3250045776367f), 15, "Вид: Липа европейская", Color.white),
                    new VertexSerializationInfo(new Vector3(1556.625f, 677.3250045776367f), 15, "Вид: Липа крупнолистная", Color.white),
                    new VertexSerializationInfo(new Vector3(1549.125f, 707.3250045776367f), 15, "Вид: Липа Нащокина", Color.white),
                    new VertexSerializationInfo(new Vector3(1531.125f, 743.3250045776367f), 15, "Вид: Липа опушённостолбиковая", Color.white),
                    new VertexSerializationInfo(new Vector3(1508.625f, 771.8250045776367f), 15, "Вид: Липа сердцевидная", Color.white),
                    new VertexSerializationInfo(new Vector3(-1184.25f, 569.3250045776367f), 15, "Род: Лиственница", Color.white),
                    new VertexSerializationInfo(new Vector3(-1319.25f, 590.3250045776367f), 15, "Вид: Лиственница амурская", Color.white),
                    new VertexSerializationInfo(new Vector3(-1304.25f, 621.8250045776367f), 15, "Вид: Лиственница Гмелина", Color.white),
                    new VertexSerializationInfo(new Vector3(-1283.25f, 651.8250045776367f), 15, "Вид: Лиственница камчатская", Color.white),
                    new VertexSerializationInfo(new Vector3(-1260.75f, 681.8250045776367f), 15, "Вид: Лиственница Каяндера", Color.white),
                    new VertexSerializationInfo(new Vector3(-1241.25f, 708.8250045776367f), 15, "Вид: Лиственница Комарова", Color.white),
                    new VertexSerializationInfo(new Vector3(-1236.75f, 740.3250045776367f), 15, "Вид: Лиственница курильская", Color.white),
                    new VertexSerializationInfo(new Vector3(-1328.25f, 543.8250045776367f), 15, "Вид: Лиственница Любарского", Color.white),
                    new VertexSerializationInfo(new Vector3(-1322.25f, 512.3250045776367f), 15, "Вид: Лиственница Миддендорфа", Color.white),
                    new VertexSerializationInfo(new Vector3(-1310.25f, 485.3250045776367f), 15, "Разновидность: Лиственница ольгинская", Color.white),
                },
                EdgeInfos = new[]
                {
                    new EdgeSerializationInfo("0", "1", null, false, 4),
                    new EdgeSerializationInfo("1", "2", null, false, 4),
                    new EdgeSerializationInfo("2", "3", null, false, 4),
                    new EdgeSerializationInfo("3", "4", null, false, 4),
                    new EdgeSerializationInfo("4", "5", null, false, 4),
                    new EdgeSerializationInfo("5", "6", null, false, 4),
                    new EdgeSerializationInfo("5", "7", null, false, 4),
                    new EdgeSerializationInfo("5", "8", null, false, 4),
                    new EdgeSerializationInfo("5", "9", null, false, 4),
                    new EdgeSerializationInfo("5", "10", null, false, 4),
                    new EdgeSerializationInfo("5", "11", null, false, 4),
                    new EdgeSerializationInfo("5", "12", null, false, 4),
                    new EdgeSerializationInfo("13", "5", null, false, 4),
                    new EdgeSerializationInfo("14", "5", null, false, 4),
                    new EdgeSerializationInfo("5", "15", null, false, 4),
                    new EdgeSerializationInfo("5", "16", null, false, 4),
                    new EdgeSerializationInfo("5", "17", null, false, 4),
                    new EdgeSerializationInfo("5", "18", null, false, 4),
                    new EdgeSerializationInfo("5", "19", null, false, 4),
                    new EdgeSerializationInfo("2", "21", null, false, 4),
                    new EdgeSerializationInfo("21", "22", null, false, 4),
                    new EdgeSerializationInfo("22", "23", null, false, 4),
                    new EdgeSerializationInfo("23", "20", null, false, 4),
                    new EdgeSerializationInfo("2", "24", null, false, 4),
                    new EdgeSerializationInfo("24", "25", null, false, 4),
                    new EdgeSerializationInfo("25", "26", null, false, 4),
                    new EdgeSerializationInfo("26", "27", null, false, 4),
                    new EdgeSerializationInfo("25", "28", null, false, 4),
                    new EdgeSerializationInfo("28", "29", null, false, 4),
                    new EdgeSerializationInfo("30", "28", null, false, 4),
                    new EdgeSerializationInfo("24", "31", null, false, 4),
                    new EdgeSerializationInfo("31", "32", null, false, 4),
                    new EdgeSerializationInfo("32", "33", null, false, 4),
                    new EdgeSerializationInfo("32", "34", null, false, 4),
                    new EdgeSerializationInfo("32", "35", null, false, 4),
                    new EdgeSerializationInfo("32", "36", null, false, 4),
                    new EdgeSerializationInfo("32", "37", null, false, 4),
                    new EdgeSerializationInfo("32", "38", null, false, 4),
                    new EdgeSerializationInfo("32", "39", null, false, 4),
                    new EdgeSerializationInfo("4", "40", null, false, 4),
                    new EdgeSerializationInfo("40", "41", null, false, 4),
                    new EdgeSerializationInfo("25", "42", null, false, 4),
                    new EdgeSerializationInfo("42", "43", null, false, 4),
                    new EdgeSerializationInfo("42", "44", null, false, 4),
                    new EdgeSerializationInfo("42", "45", null, false, 4),
                    new EdgeSerializationInfo("3", "46", null, false, 4),
                    new EdgeSerializationInfo("46", "47", null, false, 4),
                    new EdgeSerializationInfo("47", "48", null, false, 4),
                    new EdgeSerializationInfo("47", "49", null, false, 4),
                    new EdgeSerializationInfo("47", "50", null, false, 4),
                    new EdgeSerializationInfo("47", "51", null, false, 4),
                    new EdgeSerializationInfo("47", "52", null, false, 4),
                    new EdgeSerializationInfo("0", "53", null, false, 4),
                    new EdgeSerializationInfo("53", "54", null, false, 4),
                    new EdgeSerializationInfo("54", "55", null, false, 4),
                    new EdgeSerializationInfo("55", "56", null, false, 4),
                    new EdgeSerializationInfo("56", "57", null, false, 4),
                    new EdgeSerializationInfo("58", "57", null, false, 4),
                    new EdgeSerializationInfo("57", "59", null, false, 4),
                    new EdgeSerializationInfo("57", "60", null, false, 4),
                    new EdgeSerializationInfo("57", "61", null, false, 4),
                    new EdgeSerializationInfo("57", "62", null, false, 4),
                    new EdgeSerializationInfo("57", "63", null, false, 4),
                    new EdgeSerializationInfo("2", "64", null, false, 4),
                    new EdgeSerializationInfo("64", "65", null, false, 4),
                    new EdgeSerializationInfo("65", "66", null, false, 4),
                    new EdgeSerializationInfo("66", "67", null, false, 4),
                    new EdgeSerializationInfo("68", "66", null, false, 4),
                    new EdgeSerializationInfo("66", "69", null, false, 4),
                    new EdgeSerializationInfo("66", "70", null, false, 4),
                    new EdgeSerializationInfo("66", "71", null, false, 4),
                    new EdgeSerializationInfo("2", "72", null, false, 4),
                    new EdgeSerializationInfo("72", "73", null, false, 4),
                    new EdgeSerializationInfo("73", "74", null, false, 4),
                    new EdgeSerializationInfo("74", "75", null, false, 4),
                    new EdgeSerializationInfo("2", "76", null, false, 4),
                    new EdgeSerializationInfo("76", "77", null, false, 4),
                    new EdgeSerializationInfo("77", "78", null, false, 4),
                    new EdgeSerializationInfo("78", "79", null, false, 4),
                    new EdgeSerializationInfo("2", "80", null, false, 4),
                    new EdgeSerializationInfo("80", "81", null, false, 4),
                    new EdgeSerializationInfo("81", "82", null, false, 4),
                    new EdgeSerializationInfo("82", "83", null, false, 4),
                    new EdgeSerializationInfo("82", "84", null, false, 4),
                    new EdgeSerializationInfo("82", "85", null, false, 4),
                    new EdgeSerializationInfo("82", "86", null, false, 4),
                    new EdgeSerializationInfo("87", "82", null, false, 4),
                    new EdgeSerializationInfo("82", "88", null, false, 4),
                    new EdgeSerializationInfo("82", "89", null, false, 4),
                    new EdgeSerializationInfo("4", "90", null, false, 4),
                    new EdgeSerializationInfo("90", "91", null, false, 4),
                    new EdgeSerializationInfo("2", "92", null, false, 4),
                    new EdgeSerializationInfo("92", "93", null, false, 4),
                    new EdgeSerializationInfo("93", "94", null, false, 4),
                    new EdgeSerializationInfo("94", "95", null, false, 4),
                    new EdgeSerializationInfo("94", "96", null, false, 4),
                    new EdgeSerializationInfo("94", "97", null, false, 4),
                    new EdgeSerializationInfo("94", "98", null, false, 4),
                    new EdgeSerializationInfo("94", "99", null, false, 4),
                    new EdgeSerializationInfo("56", "100", null, false, 4),
                    new EdgeSerializationInfo("100", "101", null, false, 4),
                    new EdgeSerializationInfo("100", "102", null, false, 4),
                    new EdgeSerializationInfo("100", "103", null, false, 4),
                    new EdgeSerializationInfo("100", "104", null, false, 4),
                    new EdgeSerializationInfo("100", "105", null, false, 4),
                    new EdgeSerializationInfo("100", "106", null, false, 4),
                    new EdgeSerializationInfo("100", "107", null, false, 4),
                    new EdgeSerializationInfo("100", "108", null, false, 4),
                    new EdgeSerializationInfo("100", "109", null, false, 4),
                },
            };

            var lightGenerator = new LightGraphGenerator(graphInfo);

            lightGenerator.Generate(graphControler);
            Graphs.Add(graphControler);
            return(graphControler);
        }