// Start is called before the first frame update
    void Start()
    {
        var roadNetwork = new RoadNetwork();

        roadNetwork.AddVertex(new RoadVertex(0, 0));
        roadNetwork.AddVertex(new RoadVertex(50, 0));
        roadNetwork.AddVertex(new RoadVertex(100, 0));

        roadNetwork.AddSegment(new RoadSegment(0, 1));
        roadNetwork.AddSegment(new RoadSegment(1, 2));

        Debug.Log(roadNetwork.ToJson(true));
    }
Example #2
0
        private void Populate1()
        {
            RoadNetwork network = new RoadNetwork();

            Vertex start = network.AddVertex(100, 10);

            Vertex a = network.AddVertex(50, 10);
            Vertex b = network.AddVertex(150, 10);
            Vertex c = network.AddVertex(50, 75);
            Vertex d = network.AddVertex(100, 75);
            Vertex e = network.AddVertex(150, 75);

            Vertex f = network.AddVertex(50, 150);
            Vertex g = network.AddVertex(100, 150);
            Vertex h = network.AddVertex(150, 150);

            Vertex i = network.AddVertex(50, 210);
            Vertex j = network.AddVertex(150, 210);

            Vertex end = network.AddVertex(100, 210);

            network.AddEdge(start, a);
            network.AddEdge(start, b);

            network.AddEdge(a, c);
            network.AddEdge(b, e);

            network.AddEdge(c, d);
            network.AddEdge(e, d);

            network.AddEdge(c, f);
            network.AddEdge(d, g);
            network.AddEdge(e, h);

            network.AddEdge(f, g);
            network.AddEdge(h, g);

            network.AddEdge(f, i);
            network.AddEdge(h, j);

            network.AddEdge(i, end);
            network.AddEdge(j, end);

            parent1.Network = network;

            ConjugationOperator op = new ConjugationOperator();

            RoadNetwork cut = new RoadNetwork(network);

            op.Cut(cut);

            cut1.Network = cut;
        }
Example #3
0
        private void Populate2()
        {
            RoadNetwork network = new RoadNetwork();

            Vertex start = network.AddVertex(100, 10);

            Vertex a = network.AddVertex(50, 50);
            Vertex b = network.AddVertex(150, 50);

            Vertex c = network.AddVertex(25, 75);
            Vertex d = network.AddVertex(100, 75);
            Vertex e = network.AddVertex(175, 75);

            Vertex f = network.AddVertex(100, 150);

            Vertex g = network.AddVertex(50, 190);
            Vertex h = network.AddVertex(150, 190);

            Vertex end = network.AddVertex(100, 210);

            network.AddEdge(start, a);
            network.AddEdge(start, b);
            network.AddEdge(a, c);
            network.AddEdge(a, d);
            network.AddEdge(b, d);
            network.AddEdge(b, e);

            network.AddEdge(c, f);
            network.AddEdge(e, f);

            network.AddEdge(f, g);
            network.AddEdge(f, h);

            network.AddEdge(g, end);
            network.AddEdge(h, end);

            parent2.Network = network;

            ConjugationOperator op = new ConjugationOperator();

            RoadNetwork cut = new RoadNetwork(network);

            op.Cut(cut);

            cut2.Network = cut;
        }