|
1 | | -import gzip |
2 | | -import os |
3 | | -import os.path |
4 | | -from itertools import islice |
| 1 | +from importlib.abc import Traversable |
| 2 | +from typing import Final |
5 | 3 |
|
6 | 4 | from numpy.typing import ArrayLike |
7 | 5 |
|
8 | | -from ..classes.graph import Graph |
9 | | - |
10 | 6 | __all__ = ["graph_atlas", "graph_atlas_g"] |
11 | 7 |
|
12 | | -#: The total number of graphs in the atlas. |
13 | | -#: |
14 | | -#: The graphs are labeled starting from 0 and extending to (but not |
15 | | -#: including) this number. |
16 | | -NUM_GRAPHS: int = ... |
17 | | - |
18 | | -#: The absolute path representing the directory containing this file. |
19 | | -THIS_DIR = ... |
20 | | - |
21 | | -#: The path to the data file containing the graph edge lists. |
22 | | -#: |
23 | | -#: This is the absolute path of the gzipped text file containing the |
24 | | -#: edge list for each graph in the atlas. The file contains one entry |
25 | | -#: per graph in the atlas, in sequential order, starting from graph |
26 | | -#: number 0 and extending through graph number 1252 (see |
27 | | -#: :data:`NUM_GRAPHS`). Each entry looks like |
28 | | -#: |
29 | | -#: .. sourcecode:: text |
30 | | -#: |
31 | | -#: GRAPH 6 |
32 | | -#: NODES 3 |
33 | | -#: 0 1 |
34 | | -#: 0 2 |
35 | | -#: |
36 | | -#: where the first two lines are the graph's index in the atlas and the |
37 | | -#: number of nodes in the graph, and the remaining lines are the edge |
38 | | -#: list. |
39 | | -#: |
40 | | -#: This file was generated from a Python list of graphs via code like |
41 | | -#: the following:: |
42 | | -#: |
43 | | -#: import gzip |
44 | | -#: from networkx.generators.atlas import graph_atlas_g |
45 | | -#: from networkx.readwrite.edgelist import write_edgelist |
46 | | -#: |
47 | | -#: with gzip.open('atlas.dat.gz', 'wb') as f: |
48 | | -#: for i, G in enumerate(graph_atlas_g()): |
49 | | -#: f.write(bytes(f'GRAPH {i}\n', encoding='utf-8')) |
50 | | -#: f.write(bytes(f'NODES {len(G:Graph)}\n', encoding='utf-8')) |
51 | | -#: write_edgelist(G:Graph, f, data=False) |
52 | | -#: |
53 | | -ATLAS_FILE = ... |
| 8 | +NUM_GRAPHS: Final = 1253 |
| 9 | +ATLAS_FILE: Traversable |
54 | 10 |
|
55 | 11 | def graph_atlas(i: int) -> ArrayLike: ... |
56 | 12 | def graph_atlas_g() -> ArrayLike: ... |
0 commit comments