class_docstr: Accepts a Graph and lays out the corresponding nodes with the
  supplied networkx layout function. If no layout function is
  supplied uses a simple circular_layout function. Also supports
  LayoutAlgorithm function provided in datashader layouts.
class_docstr_tok: ["Accepts","a","Graph","and","lays","out","the","corresponding","nodes","with","the","supplied","networkx","layout","function",".","If","no","layout","function","is","supplied","uses","a","simple","circular_layout","function",".","Also","supports","LayoutAlgorithm","function","provided","in","datashader","layouts","."]
code: def _process(self, element, key=None):
      if self.p.layout and isinstance(self.p.layout, FunctionType):
          import networkx as nx
  
          edges = element.array([0, 1])
          graph = nx.from_edgelist(edges)
          if "weight" in self.p.kwargs:
              weight = self.p.kwargs["weight"]
              for (s, t), w in zip(edges, element[weight]):
                  graph.edges[s, t][weight] = w
          positions = self.p.layout(graph, **self.p.kwargs)
          nodes = [
              tuple(pos) + (idx,)
              for idx, pos in sorted(positions.items())
          ]
      else:
          source = element.dimension_values(0, expanded=False)
          target = element.dimension_values(1, expanded=False)
          nodes = np.unique(np.concatenate([source, target]))
          if self.p.layout:
              df = pd.DataFrame({"index": nodes})
              nodes = self.p.layout(
                  df, element.dframe(), **self.p.kwargs
              )
              nodes = nodes[["x", "y", "index"]]
          else:
              nodes = circular_layout(nodes)
      nodes = element.node_type(nodes)
      if element._nodes:
          for d in element.nodes.vdims:
              vals = element.nodes.dimension_values(d)
              nodes = nodes.add_dimension(
                  d, len(nodes.vdims), vals, vdim=True
              )
      if self.p.only_nodes:
          return nodes
      return element.clone((element.data, nodes))
  
imports: from collections import defaultdict
  from types import FunctionType
  import numpy
  import pandas
  import param
  from ..core import Dataset, Dimension, Element2D
  from ..core.accessors import Redim
  from ..core.operation import Operation
  from ..core.util import is_dataframe, max_range, search_indices
  from .chart import Points
  from .path import Path
  from .util import circular_layout, connect_edges_pd, connect_tri_edges_pd, quadratic_bezier, split_path
label_desc: Use image node_id 1 for calling the layout_nodes obj's underlying member method code with example usage: obj._process(element, key) and returns: element, nodes