Can we use "sankey" type as a tree structure

I have a requirement of tree with “sankey” style.
I tried with basic example and it works till some extent. eg. after expanding and collapsing it doesn’t behave like tree. Can I get the same behaviour somehow like trees?

I replaced the JSON-formatted model in Sankey Diagram with:

{ "class": "go.GraphLinksModel",
  "nodeDataArray": [
    {"key":"root", "text":"Root", "color":"#9d75c2"},
    {"key":"One", "text":"One", "color":"#9d75c2"},
    {"key":"Two", "text":"Two", "color":"#9d75c2"},
    {"key":"Three", "text":"Three", "color":"#9d75c2"},
    {"key":"Four", "text":"Four", "color":"#9d75c2"},
    {"key":"Six", "text":"Six", "color":"#9d75c2"}
  ],
  "linkDataArray": [
    {"from":"root", "to":"One", "width":80},
    {"from":"One", "to":"Three", "width":70},
    {"from":"One", "to":"Four", "width":30},
    {"from":"root", "to":"Two", "width":10},
    {"from":"root", "to":"Six", "width":10}
  ]
}

In order to support expanding/collapsing nodes in the tree, I added this declaration in the node template:

    myDiagram.nodeTemplate =
      $(go.Node, go.Panel.Horizontal,
        {
          doubleClick: function(e, node) {
            if (node.isTreeExpanded) {
              e.diagram.commandHandler.collapseTree(node);
            } else {
              e.diagram.commandHandler.expandTree(node);
            }
          },
          . . .

And collapsing and expanding double-clicked nodes worked well. So what is the problem that you have?

Thanks, but that i have already achieved, as shown in above screenshot. its expanding and collapsing. but its not like tree structure. The node goes to all way right, whereas i want all direct children on the same level.

One, two and six should be on the same level and three, four should be on the same level.

That is intentional behavior of the SankeyLayout. Just remove the override of assignLayers.

Thanks it worked.