code: def __init__(self):
      app.Canvas.__init__(
          self,
          title="Simple NetworkX Graph",
          keys="interactive",
          size=(600, 600),
      )
  
      graph = nx.adjacency_matrix(
          nx.fast_gnp_random_graph(500, 0.005, directed=True)
      )
      layout = layouts.get_layout("force_directed", iterations=100)
  
      self.visual = visuals.GraphVisual(
          graph,
          layout=layout,
          line_color="black",
          arrow_type="stealth",
          arrow_size=30,
          node_symbol="disc",
          node_size=20,
          face_color=(1, 0, 0, 0.5),
          border_width=0.0,
          animate=True,
          directed=False,
      )
  
      self.visual.transform = STTransform(self.visual_size, (20, 20))
      self.show()
  
file_path: vispy/examples/basics/visuals/graph.py
imports: import sys
  import networkx
  from vispy import app, visuals
  from vispy.visuals.graphs import layouts
  from vispy.visuals.transforms import STTransform
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()