Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in num_nodes #41

Open
psanch21 opened this issue Feb 1, 2022 · 0 comments
Open

Error in num_nodes #41

psanch21 opened this issue Feb 1, 2022 · 0 comments

Comments

@psanch21
Copy link

psanch21 commented Feb 1, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant