Quantcast
Channel: Get deep of a logic hierarchical structure - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Get deep of a logic hierarchical structure

$
0
0

I have the data that represent hierarchical structure

|id|parent_id|data||1 |0        |cat1||2 |1        |cat2||3 |4        |cat3||4 |5        |cat4|   |5 |0        |cat5|

That represent a hierarchical structure like this

1|_2|5|_4  |_3

I need to implement some function or algorithm prefirible that allowme to create a hierarchical structure and get the deep of every node according to the logic structure. i mean get this information.

|id|parent_id|data|deep||1 |0        |cat1|0   ||2 |1        |cat2|1   ||3 |4        |cat3|2   ||4 |5        |cat4|1   ||5 |0        |cat5|0   |

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>