简体   繁体   中英

How to get the number of graphs in a NetworkX graph set?

I have a set of graphs stored as a NetworkX class. Is there any command to get the number of graphs in the NetworkX graph set? Something like.shape in pandas dataframe. Currently, I use the following code, but I am looking for a simpler way.

x = 0
for ii, bb in enumerate(graph_set):
    x += 1
print(x) 

You can simply use len() like this:

len(graph_set)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM