Код: Выделить всё
>> G = nx.DiGraph()
>> G.add_edges_from(product([0],[1,2])) # product is itertools.product
>> G.add_edges_from(product([1],[3,4]))
Код: Выделить всё
>> G.adj
{0: {1: {}, 2: {}},
1: {3: {}, 4: {}},
2: {},
3: {},
4: {}}
Код: Выделить всё
{
name: 0,
children: [
{
name: 1,
children: [
{
name: 3,
children: []
},
{
name: 4,
children: []
}
]
},
{
name: 2,
children:[]
}
]
}
Я не знаю, как это сделать. Любая помощь очень ценится.
спасибо.
Подробнее здесь: https://stackoverflow.com/questions/193 ... son-format
Мобильная версия