text: Hi everybody,
  I was trying to add various values to a custom data type I created but for some reason just the first one gets added to the list.
  I want to generate a adjacency list for nodes in a graph iterating over all edges and adding the neighbor.
  If I do the same operation with a dataTree it works as expected.
  private void RunScript(DataTree<int> edges, int x, ref object A, ref object B) { var nodes = new List<Node>(); var adj = new DataTree<int>(); for (int i = 0; i < edges.BranchCount; i++) { // why does it not work like this Node n1 = new Node(edges.Branch(i)[0]); Node n2 = new Node(edges.Branch(i)[1]); nodes.Add(n1); nodes.Add(n2); n1.AdjN.Add(n2); n2.AdjN.Add(n1); //I thought it would be the equivalent to this: adj.Add(n1.name, new GH_Path(n2.name)); adj.Add(n2.name, new GH_Path(n1.name)); } // get the indices of the adjacent nodes var neighbors = new List<int>(); for (int i = 0; i < nodes[x].AdjN.Count; i++) neighbors.Add(nodes[x].AdjN[i].name); A = neighbors; B = adj; } // <Custom additional code> public class Node { //Properties public int name; public List<Node> AdjN; // constructor that takes the current node and initializes the adjList public Node(int _node) { name = _node; AdjN = new List<Node>(); } }
  If someone could give me a hint really apreciated.
  Thanks for everyone and have a nice weekend!
  File:20200625_CDT.gh (15.5 KB)