2012-07-05 72 views
0

我有一個具有樹的鄰接表示的JSON字符串。我需要編寫一個程序來可視化這棵樹。 會有什麼可能的問題? 我需要像從產生的Weka ..從其鄰接列表表示生成樹的程序

樣品JSON是:

[{ 
      "parent_index" : -1, 
      "ClassLable" : "TEMPERATURE", 
      "ChildNum" : 4, 
      "AttributeTest" : "NULL" 
    }, { 
      "parent_index" : 0, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : "<65" 
    }, { 
      "parent_index" : 0, 
      "ClassLable" : "WINDY", 
      "ChildNum" : 2, 
      "AttributeTest" : "65-80.5" 
    }, { 
      "parent_index" : 2, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : "false" 
    }, { 
      "parent_index" : 2, 
      "ClassLable" : "HUMIDITY", 
      "ChildNum" : 4, 
      "AttributeTest" : "true" 
    }, { 
      "parent_index" : 4, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : "<64" 
    }, { 
      "parent_index" : 4, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : "64-74.5" 
    }, { 
      "parent_index" : 4, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : "74.5-85" 
    }, { 
      "parent_index" : 4, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : ">85" 
    }, { 
      "parent_index" : 0, 
      "ClassLable" : "HUMIDITY", 
      "ChildNum" : 4, 
      "AttributeTest" : "80.5-96" 
    }, { 
      "parent_index" : 9, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : "<64" 
    }, { 
      "parent_index" : 9, 
      "ClassLable" : "WINDY", 
      "ChildNum" : 2, 
      "AttributeTest" : "64-74.5" 
    }, { 
      "parent_index" : 11, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : "false" 
    }, { 
      "parent_index" : 11, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : "true" 
    }, { 
      "parent_index" : 9, 
      "ClassLable" : "WINDY", 
      "ChildNum" : 2, 
      "AttributeTest" : "74.5-85" 
    }, { 
      "parent_index" : 14, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : "false" 
    }, { 
      "parent_index" : 14, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : "true" 
    }, { 
      "parent_index" : 9, 
      "ClassLable" : "no", 
      "ChildNum" : 0, 
      "AttributeTest" : ">85" 
    }, { 
      "parent_index" : 0, 
      "ClassLable" : "yes", 
      "ChildNum" : 0, 
      "AttributeTest" : ">96" 
    } 
] 

回答

0

我使用的谷歌圖表API生成的樹(I所用的組織結構圖API)