class_docstr: Sankey is an acyclic, directed Graph type that represents the flow
  of some quantity between its nodes.
class_docstr_tok: ["Sankey","is","an","acyclic",",","directed","Graph","type","that","represents","the","flow","of","some","quantity","between","its","nodes","."]
code: def __init__(self, data, kdims=None, vdims=None, **params):
      if data is None:
          data = []
      if isinstance(data, tuple):
          data = data + (None,) * (3 - len(data))
          edges, nodes, edgepaths = data
      else:
          edges, nodes, edgepaths = data, None, None
      sankey_graph = params.pop("sankey", None)
      compute = not (
          sankey_graph
          and isinstance(nodes, Nodes)
          and isinstance(edgepaths, EdgePaths)
      )
      super(Graph, self).__init__(
          edges, kdims=kdims, vdims=vdims, **params
      )
      if compute:
          if nodes is None:
              src = self.dimension_values(0, expanded=False)
              tgt = self.dimension_values(1, expanded=False)
              values = unique_array(np.concatenate([src, tgt]))
              nodes = Dataset(values, "index")
          elif not isinstance(nodes, Dataset):
              try:
                  nodes = Dataset(nodes)
              except Exception:
                  nodes = Dataset(nodes, "index")
          if not nodes.kdims:
              raise ValueError(
                  "Could not determine index in supplied node data. "
                  "Ensure data has at least one key dimension, "
                  "which matches the node ids on the edges."
              )
          self._nodes = nodes
          nodes, edgepaths, graph = _layout_sankey.instance().layout(
              self
          )
          self._nodes = nodes
          self._edgepaths = edgepaths
          self._sankey = graph
      else:
          if not isinstance(nodes, self.node_type):
              raise TypeError(
                  f"Expected Nodes object in data, found {type(nodes)}."
              )
          self._nodes = nodes
          if not isinstance(edgepaths, self.edge_type):
              raise TypeError(
                  "Expected EdgePaths object in data, found %s."
                  % type(edgepaths)
              )
          self._edgepaths = edgepaths
          self._sankey = sankey_graph
      self._validate()
  
imports: import math
  from functools import cmp_to_key
  from itertools import cycle
  import numpy
  import param
  from ..core.data import Dataset
  from ..core.dimension import Dimension
  from ..core.operation import Operation
  from ..core.util import get_param_values, unique_array
  from .graphs import EdgePaths, Graph, Nodes
  from .util import quadratic_bezier
label_desc: Use image node_id 1 to create a new Sankey object from inherited base classes: Graph with example: obj = Sankey(data, kdims, vdims)