Exemplo n.º 1
0
        private void RunClick(object sender, RoutedEventArgs e)
        {
            var graph = DirectedWeightedGraph.CreateEmpty(3);

            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[0], graph.Vertices[1], 2));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[0], graph.Vertices[2], 6));
            graph.Vertices[0].DisplayName = "hi";
            Visualizer.Graph = graph;
            //((Vertex)Visualizer.Vertices[3]).Background = new SolidColorBrush(Colors.Magenta);
            //((Vertex)Visualizer.Vertices[1]).Radius = 30;
            _visualizerGraphProto       = graph;
            ((Button)sender).Visibility = Visibility.Collapsed;
        }
Exemplo n.º 2
0
        /// <summary>asdsf </summary>
        public static byte[] GetSerializedWeightedGraph()
        {
            var graph = DirectedWeightedGraph.CreateEmpty(8);

            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[0], graph.Vertices[1], 2));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[0], graph.Vertices[6], 6));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[1], graph.Vertices[2], 7));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[1], graph.Vertices[4], 2));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[2], graph.Vertices[3], 3));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[4], graph.Vertices[5], 2));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[4], graph.Vertices[6], 1));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[5], graph.Vertices[2], 1));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[5], graph.Vertices[7], 2));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[6], graph.Vertices[7], 4));
            graph.AddEdge(new DirectedWeightedEdge(graph.Vertices[7], graph.Vertices[3], 1));

            return(GraphSerializer.Serialize(graph));
        }