Canguro.Model.Model.GetConnectivityGraph C# (CSharp) Method

GetConnectivityGraph() public method

Creates and returns a connectivity graph in the form of an adjacency list. Each joint is a vertex in the garph and each element is one or more (areas) edges.
public GetConnectivityGraph ( ) : List>
return List>
        public List<LinkedList<int>> GetConnectivityGraph()
        {
            List<LinkedList<int>> list = new List<LinkedList<int>>(jointList.Count);
            for (int i = 0; i < jointList.Count; i++)
                list.Add(null);

            foreach (LineElement element in lineList)
            {
                if (element != null && element.I != null && element.J != null)
                {
                    int i = (int)element.I.Id;
                    int j = (int)element.J.Id;
                    if (list[i] == null)
                        list[i] = new LinkedList<int>();
                    if (list[j] == null)
                        list[j] = new LinkedList<int>();
                    list[i].AddLast(j);
                    list[j].AddLast(i);
                }
            }

            return list;
        }