最近這個問題困擾我半天,我有以下json數據
[
{"prev_node": "0000000000000005","next_node": "0000000000000006"},
{"prev_node": "0000000000000006","next_node": "0000000000000007"},
{"prev_node": "0000000000000006","next_node": "0000000000000008"},
{"prev_node": "0000000000000008","next_node": "0000000000000012"},
{"prev_node": "0000000000000009","next_node": "0000000000000010"},
{"prev_node": "0000000000000010","next_node": "0000000000000011"},
{"prev_node": "0000000000000014","next_node": "0000000000000015"},
{"prev_node": "0000000000000015","next_node": "0000000000000016"},
{"prev_node": "0000000000000016","next_node": "0000000000000017"},
{"prev_node": "0000000000000018","next_node": "0000000000000019"},
{"prev_node": "0000000000000020","next_node": "0000000000000021"},
{"prev_node": "0000000000000019","next_node": "0000000000000020"},
{"prev_node": "0000000000000012","next_node": "0000000000000022"},
{"prev_node": "0000000000000022","next_node": "0000000000000023"},
{"prev_node": "0000000000000023","next_node": "0000000000000009"},
{"prev_node": "0000000000000011","next_node": "0000000000000024"},
{"prev_node": "0000000000000024","next_node": "0000000000000014"},
{"prev_node": "0000000000000017","next_node": "0000000000000025"},
{"prev_node": "0000000000000025","next_node": "0000000000000018"},
{"prev_node": "0000000000000007","next_node": "0000000000000021"},
{"prev_node": null,"next_node": "0000000000000005"},
{"prev_node": "0000000000000021","next_node": null}
]
其中,prev_node代表上一個節點,next_node為下一節點.如果prev_node為Null,則代表當前為第一個節點.next_node為null為最後一個節點.根據資料得到以下流程圖
#求目前深度最深的流程有哪些節點,和流程的有幾個分支
註:節點只能向下走