I have a list of edge lists that construct a tree:
[
{'start': 'A', 'end': 'B'},
{'start': 'B', 'end': 'C'},
{'start': 'B', 'end': 'D'},
{'start': 'D', 'end': 'E'},
{'start': 'D', 'end': 'F'},
{'start': 'D', 'end': 'G'},
]
And I use a recursive function to turn the data into a nested from:
{
'name': 'A',
'children': [
{
'name': 'B',
'children': [
{
'name': 'C',
'children': []
},
{
'name': 'D',
'children': [
{
'name': 'E',
'children': []
},
{
'name': 'F',
'children': []
},
{
'name': 'G',
'children': []
},
]
}
]
}
]
}
I want to ask if d3js already has something built-in that would achieve the same result ?