History of chicago_road
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Lay out the spatial networks with hfd_layout() instead of cfd_layout() cc3bcb0
Changed: none
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 52800e9..9ea85b1 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -135,6 +135,6 @@ def parse(alts=None):
def get_pos(g, sbm_fit):
- # Spatial network: laid out with the default parameters of cfd_layout(),
+ # Spatial network: laid out with the default parameters of hfd_layout(),
# without the partition of the SBM fit
- return cfd_layout(g)
+ return hfd_layout(g)
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index aecaa7e..52800e9 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -36,7 +36,7 @@ The network has the following properties:
tags = ['Transportation', 'Roads', 'Weighted', 'Metadata', 'Spatial']
url = 'https://github.com/bstabler/TransportationNetworks/tree/master/chicago-regional'
citation = [('Transportation Networks for Research Core Team, "Transportation Networks for Research."', 'https://github.com/bstabler/TransportationNetworks')]
-icon_hash = '57f2dfc78cf714f319c3912d'
+date_added = '2020-08-11'
upstream_license = ("For academic research purposes only", "https://github.com/bstabler/TransportationNetworks#license")
# Repository at a fixed commit (the same as in the tntp entry)
upstream_prefix = 'https://raw.githubusercontent.com/bstabler/TransportationNetworks/d1639b4ef218c17928ba573e806ddf8ba5e7ae6d/chicago-regional'
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 64d8a55..aecaa7e 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -23,8 +23,16 @@ description = """The road network of the Chicago region, USA, as a detailed repr
The network has the following properties:
-- Nodes: `is_zone`, whether the node is a zone (zones are numbered first, and only the nodes from number `first_thru_node`, a graph property, on can be traversed by through traffic); `pos`, the position of the node, in planar coordinates of unspecified units.
-- Edges: `capacity`, the link capacity; `length`, in miles; `free_flow_time`, the travel time at zero flow, in minutes; `b` and `power`, the parameters of the link travel time function, travel time = free_flow_time * (1 + b * (flow / capacity)^power); `speed`, the speed limit (inconsistent with the free flow time on some links, according to the repository); `toll`, in cents; `link_type`, a link classification (undocumented); `flow` and `flow_cost`, the best known user-equilibrium link flow and the corresponding link travel cost, provided with the network."""
+- (Node) `is_zone`: whether the node is a zone (zones are numbered first, and only the nodes from number `first_thru_node`, a graph property, on can be traversed by through traffic).
+- (Node) `pos`: the position of the node, in planar coordinates of unspecified units.
+- (Edge) `capacity`: the link capacity.
+- (Edge) `length`: in miles.
+- (Edge) `free_flow_time`: the travel time at zero flow, in minutes.
+- (Edge) `b` and `power`: the parameters of the link travel time function, travel time = free_flow_time * (1 + b * (flow / capacity)^power).
+- (Edge) `speed`: the speed limit (inconsistent with the free flow time on some links, according to the repository).
+- (Edge) `toll`: in cents.
+- (Edge) `link_type`: a link classification (undocumented).
+- (Edge) `flow` and `flow_cost`: the best known user-equilibrium link flow and the corresponding link travel cost, provided with the network."""
tags = ['Transportation', 'Roads', 'Weighted', 'Metadata', 'Spatial']
url = 'https://github.com/bstabler/TransportationNetworks/tree/master/chicago-regional'
citation = [('Transportation Networks for Research Core Team, "Transportation Networks for Research."', 'https://github.com/bstabler/TransportationNetworks')]
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 5c551bd..64d8a55 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -59,7 +59,6 @@ def split_tntp(line):
"flow": "double", "flow_cost": "double"})
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] Lay out spatial networks with cfd_layout() without the SBM partition 9db8d77
Road, power grid, public transport, water and river networks and physical meshes override get_pos() with the default parameters of cfd_layout(), without grouping by the partition of the SBM fit.
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 1e671ec..5c551bd 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -125,3 +125,9 @@ def parse(alts=None):
g.ep.flow[e] = float(r[2])
g.ep.flow_cost[e] = float(r[3])
yield alt, g
+
+
+def get_pos(g, sbm_fit):
+ # Spatial network: laid out with the default parameters of cfd_layout(),
+ # without the partition of the SBM fit
+ return cfd_layout(g)
[entries] Move KONECT-derived entries to their original sources 45943ea
The entries now download the data from where KONECT obtained them (live or via the Wayback Machine), gaining the metadata KONECT dropped (names, identifiers, timestamps, attributes), with descriptions and citations rewritten from the original sources: - Ma'ayan lab collection: faa_routes, foodweb_little_rock (taxon names were assigned to the wrong nodes), interactome_pdz, interactome_figeys, interactome_stelzl, interactome_vidal - Pajek collection and primary sources: word_assoc (from the Edinburgh Associative Thesaurus; KONECT dropped all counts >= 10), foldoc, new_guinea_tribes - bitriad: elite, ceo_club (adds the CEO KONECT's copy lacked) - Lovro Subelj: cora, euroroad (adds isolated cities and parallel roads) - SNAP: elec (all votes, with elections and nominators) - Zenodo: wiki_talk (user ids and roles) - MPI-SWS: flickr_growth, facebook_wall (edges now point from poster to wall owner, as documented), wikipedia_growth (full timestamps) - Other sources: prosper, jester, reactome (the 2014 release KONECT used), unicodelang (CLDR 27), wordnet (WordNet 3.1), chicago_road (TNTP ChicagoRegional)
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 2cafcfb..1e671ec 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -19,21 +19,44 @@
from .. import *
title = "Chicago road network"
-description = """A transportation network of Chicago, USA, from an unknown date (probably late 20th century). Nodes represent intersections or endpoints and edge represent the road connecting these nodes.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
-tags = ['Transportation', 'Roads', 'Unweighted']
-url = 'http://konect.cc/networks/tntp-ChicagoRegional'
-citation = [('B. Stabler, "Transportation Network Test Problems."', 'https://github.com/bstabler/TransportationNetworks')]
+description = """The road network of the Chicago region, USA, as a detailed representation prepared by the Chicago Area Transportation Study (CATS) for traffic assignment (the year of the underlying data is not documented), from the Transportation Networks for Research repository maintained by B. Stabler, H. Bar-Gera and E. Sall, which continues H. Bar-Gera's earlier "Transportation Network Test Problems" (TNTP) collection. Nodes are intersections or other points of the road network, or zone centroids (artificial nodes representing the 1,790 traffic analysis zones, where trips start and end), and directed edges are road links, including the artificial "centroid connector" links that join the zones to the road network. Some ramps that are one-way in reality are coded as bidirectional links, and three nodes (numbers 9365, 12976 and 12977) have no links. The origin-destination demand table that accompanies the network in the repository is not included. (This network is also part of the `tntp` entry, as `chicago_regional`.)
+
+The network has the following properties:
+
+- Nodes: `is_zone`, whether the node is a zone (zones are numbered first, and only the nodes from number `first_thru_node`, a graph property, on can be traversed by through traffic); `pos`, the position of the node, in planar coordinates of unspecified units.
+- Edges: `capacity`, the link capacity; `length`, in miles; `free_flow_time`, the travel time at zero flow, in minutes; `b` and `power`, the parameters of the link travel time function, travel time = free_flow_time * (1 + b * (flow / capacity)^power); `speed`, the speed limit (inconsistent with the free flow time on some links, according to the repository); `toll`, in cents; `link_type`, a link classification (undocumented); `flow` and `flow_cost`, the best known user-equilibrium link flow and the corresponding link travel cost, provided with the network."""
+tags = ['Transportation', 'Roads', 'Weighted', 'Metadata', 'Spatial']
+url = 'https://github.com/bstabler/TransportationNetworks/tree/master/chicago-regional'
+citation = [('Transportation Networks for Research Core Team, "Transportation Networks for Research."', 'https://github.com/bstabler/TransportationNetworks')]
icon_hash = '57f2dfc78cf714f319c3912d'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.tntp-ChicagoRegional.tar.bz2', None, 'konect')]
+upstream_license = ("For academic research purposes only", "https://github.com/bstabler/TransportationNetworks#license")
+# Repository at a fixed commit (the same as in the tntp entry)
+upstream_prefix = 'https://raw.githubusercontent.com/bstabler/TransportationNetworks/d1639b4ef218c17928ba573e806ddf8ba5e7ae6d/chicago-regional'
+files = [(('ChicagoRegional_net.tntp', 'ChicagoRegional_node.tntp',
+ 'ChicagoRegional_flow.tntp'), None, None)]
def fetch_upstream(force=False):
return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
force)
+def split_tntp(line):
+ """Split a TNTP record into its fields (tab-separated, possibly padded
+ with spaces, and terminated by a semicolon)."""
+ line = line.strip()
+ if line.endswith(";"):
+ line = line[:-1]
+ vals = [x.strip() for x in line.split("\t")]
+ while vals and vals[-1] == "":
+ vals.pop()
+ while vals and vals[0] == "":
+ vals.pop(0)
+ return vals
+
@cache_network()
-@coerce_props()
+@coerce_props(eforce={"capacity": "double", "length": "double",
+ "free_flow_time": "double", "b": "double",
+ "power": "double", "speed": "double", "toll": "double",
+ "flow": "double", "flow_cost": "double"})
@annotate()
def parse(alts=None):
global files
@@ -41,9 +64,64 @@ def parse(alts=None):
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
continue
- if isinstance(fnames, str):
- fnames = [fnames]
- with ExitStack() as stack:
- fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
- g = parse_graph(fs, fmt, directed=False)
+ meta = {}
+ cols = None
+ rows = []
+ with open_upstream_file(name, fnames[0], "r") as f:
+ for line in f:
+ s = line.strip()
+ if s.startswith("<"):
+ if not s.startswith("<END OF METADATA>"):
+ key, val = s[1:].split(">", 1)
+ meta[key] = val.strip()
+ continue
+ if s.startswith("~"):
+ cols = split_tntp(s[1:])
+ continue
+ vals = split_tntp(s)
+ if len(vals) >= 2:
+ rows.append(vals)
+ n_zones = int(meta["NUMBER OF ZONES"])
+ n_nodes = int(meta["NUMBER OF NODES"])
+ g = Graph(directed=True)
+ g.add_vertex(n_nodes)
+ g.vp.is_zone = g.new_vp("bool")
+ g.vp.is_zone.a[:n_zones] = True
+ g.gp.first_thru_node = g.new_gp("int", val=int(meta["FIRST THRU NODE"]))
+ assert cols[:2] == ["init_node", "term_node"]
+ eprops = [g.new_ep("int" if c == "link_type" else "double")
+ for c in cols[2:]]
+ for c, ep in zip(cols[2:], eprops):
+ g.ep[c] = ep
+ elist = []
+ for r in rows:
+ assert len(r) == len(cols)
+ elist.append([int(r[0]) - 1, int(r[1]) - 1] +
+ [int(x) if c == "link_type" else float(x)
+ for c, x in zip(cols[2:], r[2:])])
+ g.add_edge_list(elist, eprops=eprops)
+ assert g.num_edges() == int(meta["NUMBER OF LINKS"])
+
+ g.vp.pos = g.new_vp("vector<double>")
+ with open_upstream_file(name, fnames[1], "r") as f:
+ next(f) # header: node X Y
+ for line in f:
+ vals = line.replace(";", " ").split()
+ if len(vals) >= 3:
+ g.vp.pos[int(vals[0]) - 1] = [float(vals[1]), float(vals[2])]
+
+ # the flow solution lists the links in the same order as the network
+ frows = []
+ with open_upstream_file(name, fnames[2], "r") as f:
+ for line in f:
+ vals = line.replace(";", " ").split()
+ if len(vals) >= 4 and vals[0].isdigit():
+ frows.append(vals)
+ assert len(frows) == g.num_edges()
+ g.ep.flow = g.new_ep("double")
+ g.ep.flow_cost = g.new_ep("double")
+ for e, r in zip(g.edges(), frows):
+ assert (int(e.source()) + 1, int(e.target()) + 1) == (int(r[0]), int(r[1]))
+ g.ep.flow[e] = float(r[2])
+ g.ep.flow_cost[e] = float(r[3])
yield alt, g
Update copyright information 73a4f0d
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index c06a109..2cafcfb 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Update copyright information 3d288ea
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index e98afe9..c06a109 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Update copyright information 8d005ae
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index ab8b4a0..e98afe9 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Update copyright info db2efcc
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 1ed7b53..ab8b4a0 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Un-orphan KONECT datasets 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index c406e77..1ed7b53 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/tntp-ChicagoRegional'
citation = [('B. Stabler, "Transportation Network Test Problems."', 'https://github.com/bstabler/TransportationNetworks')]
icon_hash = '57f2dfc78cf714f319c3912d'
upstream_prefix = 'http://konect.cc/files'
-orphan = True
files = [('download.tsv.tntp-ChicagoRegional.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Update citations to use DOIs e878874
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 2687804..c406e77 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -23,7 +23,7 @@ description = """A transportation network of Chicago, USA, from an unknown date
[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Transportation', 'Roads', 'Unweighted']
url = 'http://konect.cc/networks/tntp-ChicagoRegional'
-citation = [('B. Stabler, "Transportation Network Test Problems." http://www.bgu.ac.il/~bargera/tntp/ (2016).', 'http://konect.cc/networks/tntp-ChicagoRegional')]
+citation = [('B. Stabler, "Transportation Network Test Problems."', 'https://github.com/bstabler/TransportationNetworks')]
icon_hash = '57f2dfc78cf714f319c3912d'
upstream_prefix = 'http://konect.cc/files'
orphan = True
Add support for 'orphan' datasets and tag konect entries e330b80
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index da81973..2687804 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/tntp-ChicagoRegional'
citation = [('B. Stabler, "Transportation Network Test Problems." http://www.bgu.ac.il/~bargera/tntp/ (2016).', 'http://konect.cc/networks/tntp-ChicagoRegional')]
icon_hash = '57f2dfc78cf714f319c3912d'
upstream_prefix = 'http://konect.cc/files'
+orphan = True
files = [('download.tsv.tntp-ChicagoRegional.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 3a82caa..da81973 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -3,18 +3,18 @@
#
# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
from .. import *
Add explicit attribution to descriptions obtained from ICON 1645314
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
index 02442b9..3a82caa 100644
--- a/entries/chicago_road/__init__.py
+++ b/entries/chicago_road/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "Chicago road network"
-description = "A transportation network of Chicago, USA, from an unknown date (probably late 20th century). Nodes represent intersections or endpoints and edge represent the road connecting these nodes."
+description = """A transportation network of Chicago, USA, from an unknown date (probably late 20th century). Nodes represent intersections or endpoints and edge represent the road connecting these nodes.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Transportation', 'Roads', 'Unweighted']
url = 'http://konect.cc/networks/tntp-ChicagoRegional'
citation = [('B. Stabler, "Transportation Network Test Problems." http://www.bgu.ac.il/~bargera/tntp/ (2016).', 'http://konect.cc/networks/tntp-ChicagoRegional')]
Initial commit cc85872
diff --git a/entries/chicago_road/__init__.py b/entries/chicago_road/__init__.py
new file mode 100644
index 0000000..02442b9
--- /dev/null
+++ b/entries/chicago_road/__init__.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Chicago road network"
+description = "A transportation network of Chicago, USA, from an unknown date (probably late 20th century). Nodes represent intersections or endpoints and edge represent the road connecting these nodes."
+tags = ['Transportation', 'Roads', 'Unweighted']
+url = 'http://konect.cc/networks/tntp-ChicagoRegional'
+citation = [('B. Stabler, "Transportation Network Test Problems." http://www.bgu.ac.il/~bargera/tntp/ (2016).', 'http://konect.cc/networks/tntp-ChicagoRegional')]
+icon_hash = '57f2dfc78cf714f319c3912d'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.tntp-ChicagoRegional.tar.bz2', None, 'konect')]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ if isinstance(fnames, str):
+ fnames = [fnames]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+ g = parse_graph(fs, fmt, directed=False)
+ yield alt, g