For Graph theory

67 views
Skip to first unread message

Starlin Mini

unread,
Jun 1, 2024, 9:30:09 AMJun 1
to networkx-discuss
How to give names (like G1,G2,...) to many graphs created using a edgelist?

Dan Schult

unread,
Jun 1, 2024, 11:37:55 AMJun 1
to networkx...@googlegroups.com
You probably don't want individual names for each graph -- it would probably be better to have a container of the graphs.
Do you have a single edgelist, or many edgelist files?

```python
edgelist_filenames = ["file1.txt", "file2.txt"]
Glist = []
for file in edgelist_filenames:
    G = nx.read_edgelist(file)
    Glist.append(G)

# later analysis
for G in Glist:
    <analysis of graph G>
```    

Starlin Mini

unread,
Jun 2, 2024, 7:30:16 AMJun 2
to networkx...@googlegroups.com
Thank you sir.

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/CA%2BXMcTPPjCq_fHb1qER7_6jagRiaMk6t2sSCzPUhYGZAndnYFw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages