private void GetTreeFromCsv(string s) { var config = new TableReaderConfig(); config.WithHeader = true; config.DelimitedString = ","; ITable csv = TableIO.FromComputer(s, config); Dictionary <int, int> dic = new Dictionary <int, int>(); int n = csv.RowCount; TreeGraph = new Graph(true); TreeGraph.NodeTable.AddColumn <double>("attribute", 0); int count = 0; for (int i = 0; i < n; i++) { // //var a = csv.Get<double>(i, "polygon"); if (0 != csv.Get <double>(i, "polygon")) { var id = csv.Get <int>(i, "id"); dic.Add(id, count); count++; TreeGraph.AddNode(); } } n = TreeGraph.ItemCount; for (int i = 0; i < csv.RowCount; i++) { var id = csv.Get <int>(i, "id"); var parentid = csv.Get <int>(i, "parentId"); if (parentid == -1) { Root = TreeGraph.GetNode(dic[id]); } else if (0 != csv.Get <double>(i, "polygon")) { id = dic[id]; parentid = dic[parentid]; TreeGraph.AddEdge(parentid, id); } } AttrTree = TreeGraph.GetSpanningTree(Root); ComputeAttribute(AttrTree.Root); }