Hello,
 
I am struggling a bit with a list which is defined in a particular way. This is the situation: 

I have a Struct called Edge that is formed by two Points defined in the struct Point in the code (below).

My input list is called "EDGE". Using that list I would like to produce two outputs:

  1. List<double[]> POINTS : contains the non-repeated points that appear in the list "EDGE".
  2. Int[,] edgeIndices: represents the same thing as the input list "EDGE" but instead of the points, I want the indices of such points as defined in the list "POINTS" previously created.

Can you please help me on this?

Please note that it is very important to use a List<double[]> and a Int[,] and not other types.
 
Many thanks! 
 
 
 
C#
using System;
using System.Collections.Generic;


namespace Test
{

    struct Point
    {
        public readonly double X;
        public readonly double Y;

        public Point(double x, double y)
        {
            X = x;
            Y = y;
        }
    }
struct Edge
C#
    {
        public Point First;
        public Point Second;

        public Edge(Point First, Point Second)
        {
            this.First = First;
            this.Second = Second;
        }
    }

    class Program
    {

        static void Main(string[] args)
        {


            ///////////////////////////INPUT////////////////////////////////////
            var EDGES = new List<Edge>();
EDGES.Add(new Edge(new Point(5, 50), new Point(20, 100))); //EDGE 01
EDGES.Add(new Edge(new Point(20, 100), new Point(30, 50))); //EDGE 12
EDGES.Add(new Edge(new Point(30, 50), new Point(10, 0))); //EDGE 23
EDGES.Add(new Edge(new Point(5, 50), new Point(30, 50))); //EDGE 02
EDGES.Add(new Edge(new Point(5, 50), new Point(10, 0))); //EDGE 03
EDGES.Add(new Edge(new Point(20, 100), new Point(80, 100))); //EDGE 14
EDGES.Add(new Edge(new Point(10, 0), new Point(80, 100))); //EDGE 34
C#
            ///////////////////////EXPECTED OUTPUTS/////////////////////////////
            ///
            ///POINTS (EXPECTED) as List<double[]>
            ///Index    X   Y
            ///  0	    5	50
            ///  1	    20	100
            ///  2	    30	50
            ///  3	    10	0
            ///  4	    80	100
            ///
            ///MULTIARRAY (EXPECTED)
            ///static int[,] edgeIndices =
            ///    {
            ///        {0, 1}, {1, 2}, {2, 3}, {0, 2},
            ///        {0, 3}, {1, 4}, {3, 4}
            ///    };


        }

    }
}