Skip to main content
`Ctrl`+`K`

# vispy.visuals.graphs.graph module

## Graph Visual

This visual can be used to visualise graphs or networks.

class vispy.visuals.graphs.graph.GraphVisual(adjacency_mat=None, directed=False, layout=None, animate=False, line_color=None, line_width=None, arrow_type=None, arrow_size=None, node_symbol=None, node_size=None, border_color=None, face_color=None, border_width=None)

  Bases: `CompoundVisual`

  Visual for displaying graphs or networks.

  Parameters:
    adjacency_mat array or sparse

      The adjacency matrix of the graph.

    directed bool

      Whether the graph is directed or not. If True, then this visual will draw arrows for the directed edges.

    layout str

      They layout to use.

    animate bool

      Whether or not to animate.

    line_color str or `vispy.color.colormap.ColorMap`

      The color to use for the edges.

    line_width number

      The edge thickness.

    arrow_type str

      The kind of arrow head to use. See `vispy.visuals.ArrowHead` for more information.

    arrow_size number

      The size of the arrow head.

    node_symbol string

      The marker to use for nodes. See `vispy.visuals.MarkersVisual` for more information.

    node_size number

      The size of the node

    border_color str or `vispy.color.colormap.ColorMap`

      The border color for nodes.

    face_color str or `vispy.color.colormap.ColorMap`

      The face color for nodes.

    border_width number

      The border size for nodes.

  See also

  `ArrowVisual`, `MarkersVisual`
  property adjacency_matrix
  property animate
  animate_layout()
  property directed
  property layout
  reset_layout()
  set_data(adjacency_mat=None, **kwargs)

    Set the data

    Parameters:
      adjacency_mat ndarray | None

        The adjacency matrix.

      **kwargs dict

        Keyword arguments to pass to the arrows.

  set_final_layout()