예제 #1
0
 public RemoveCommandImpl(ElementoGrafo elem)
 {
     this.elem = elem;
 }
예제 #2
0
        public void CreateElemento()
        {
            if (this.nombreselementos.Any(x => x == "cakita"))
            {
                // such a person already exists: there should be some validation message, but
                // it is not so important in a demo
                return;
            }

            var p = new ElementoGrafo(this.Graph) { nombre = "cakita" };
            this.Graph.AddVertex(p);
        }
예제 #3
0
        public generagrafo()
        {
            var graph = new Graph<ElementoGrafo>();
            var subgraph = new SubGraph<ElementoGrafo>() { Label = "Colectivo" };
            var a = new ElementoGrafo(graph) { nombre = "pasaje", valor = 500 };
            var b = new ElementoGrafo(graph) { nombre = "pasajeros", valor = 25 };
            var c = new ElementoGrafo(graph) { nombre = "bencina", valor = 1000 };
            graph.AddSubGraph(subgraph);
            subgraph.AddVertex(a);
            subgraph.AddVertex(b);

            graph.AddVertex(c);

            graph.AddEdge(new Edge<ElementoGrafo>(a, b));
            graph.AddEdge(new Edge<ElementoGrafo>(c, b));
            graph.AddEdge(new Edge<ElementoGrafo>(c, a));

            this.Graph = graph;
            this.Graph.Changed += GraphChanged;
        }
예제 #4
0
 public void cambiarelemento(ElementoGrafo l, int nuevovalor)
 {
     l.valor = nuevovalor;
 }
예제 #5
0
        public void CreateElemento(Elemento elemento, Nivel n)
        {
            if (this.nombreselementos.Any(x => x == elemento.nombre))
            {
                // such a person already exists: there should be some validation message, but
                // it is not so important in a demo
                return;
            }

            var p = new ElementoGrafo(this.Graph) { nombre = elemento.nombre, valor = (int)elemento.valor };
            int i = revisarsubgrafo(n);
            if (i != -1)
            {
                this.Graph.SubGraphs.ElementAt(i).AddVertex(p);
            }
            else
            {
                SubGraph<ElementoGrafo> sg2 = new SubGraph<ElementoGrafo>() { Label = n.nombre};
                sg2.AddVertex(p);
                this.Graph.AddSubGraph(sg2);
                if (existeenotrosubgrafo(sg2.Label))
                {
                    createlink(sg2, buscarsubgrafo(n.nombre));
                }
            }
        }