deepsnap
deepsnap copied to clipboard
Error in num_nodes
Hi,
I'm getting an error in the function num_nodes
because sometimes self.G
is a list.
https://github.com/snap-stanford/deepsnap/blob/6197dcefc7934c6019fe2f4b0aada562e6c17c7d/deepsnap/graph.py#L220
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