class_docstr: Fruchterman-Reingold implementation adapted from NetworkX.
  
  In the Fruchterman-Reingold algorithm, the whole graph is modelled as a
  collection of particles, it runs a simplified particle simulation to
  find a nice layout for the graph.
  
  Parameters
  ----------
  optimal : number
      Optimal distance between nodes. Defaults to :math:`1/\\sqrt{N}` where
      N is the number of nodes.
  iterations : int
      Number of iterations to perform for layout calculation.
  pos : array
      Initial positions of the nodes
  
  Notes
  -----
  The algorithm is explained in more detail in the original paper [1]_.
  
  .. [1] Fruchterman, Thomas MJ, and Edward M. Reingold. "Graph drawing by
     force-directed placement." Softw., Pract. Exper. 21.11 (1991),
     1129-1164.
docstr: Starts the calculation of the graph layout.
  
  This is a generator, and after each iteration it yields the new
  positions for the nodes, together with the vertices for the edges
  and the arrows.
  
  There are two solvers here: one specially adapted for SciPy sparse
  matrices, and the other for larger networks.
  
  Parameters
  ----------
  adjacency_mat : array
      The graph adjacency matrix.
  directed : bool
      Wether the graph is directed or not. If this is True,
      it will draw arrows for directed edges.
  
  Yields
  ------
  layout : tuple
      For each iteration of the layout calculation it yields a tuple
      containing (node_vertices, line_vertices, arrow_vertices). These
      vertices can be passed to the `MarkersVisual` and `ArrowVisual`.
code: def __call__(self, adjacency_mat, directed=False):
      """
      Starts the calculation of the graph layout.
  
      This is a generator, and after each iteration it yields the new
      positions for the nodes, together with the vertices for the edges
      and the arrows.
  
      There are two solvers here: one specially adapted for SciPy sparse
      matrices, and the other for larger networks.
  
      Parameters
      ----------
      adjacency_mat : array
          The graph adjacency matrix.
      directed : bool
          Wether the graph is directed or not. If this is True,
          it will draw arrows for directed edges.
  
      Yields
      ------
      layout : tuple
          For each iteration of the layout calculation it yields a tuple
          containing (node_vertices, line_vertices, arrow_vertices). These
          vertices can be passed to the `MarkersVisual` and `ArrowVisual`.
      """
      if adjacency_mat.shape[0] != adjacency_mat.shape[1]:
          raise ValueError("Adjacency matrix should be square.")
  
      self.num_nodes = adjacency_mat.shape[0]
  
      if issparse(adjacency_mat):
          # Use the sparse solver
          solver = self._sparse_fruchterman_reingold
      else:
          solver = self._fruchterman_reingold
  
      for result in solver(adjacency_mat, directed):
          yield result
  
file_path: vispy/vispy/visuals/graphs/layouts/force_directed.py
imports: import numpy
  from ..util import _straight_line_vertices, _rescale_layout
label_desc: Use image node_id 2 for calling the fruchterman_reingold obj's underlying member method code with example usage: obj.__call__(adjacency_mat, directed) without return types