Unpivot Spark Data Frame, function alike pandas melt, establish Hierarchical relation using numpy and pandas netwotkx