Skip to main content

Graph.num_vertices

Find the number of vertices in the graph

Usage

num_vertices()

Returns:
      int
            The number of vertices present in the graph

Example

from jellybeans.structures import Graphg = Graph()print(g.num_vertices()) # 0g.add_vertex(1)g.add_vertex(5)g.add_vertex(11)print(g.num_vertices()) # 3g.delete_vertex(5)print(g.num_vertices()) # 2