Skip to content

Error in num_nodes #41

Description

@psanch21

Hi,

I'm getting an error in the function num_nodes because sometimes self.G is a list.

def num_nodes(self) -> int:

Would it possible to update such function and just return the length of the attribute G.nodes? Something like this

  @property
  def num_nodes(self) -> int:
      r"""
      Return number of nodes in the graph.

      Returns:
          int: Number of nodes in the graph.
      """
      G = None
      if isinstance(self.G, list):
          G = self.G[0]
      else:
          G = self.G

      return len(G.nodes)

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions