Skip to content

Commit

Permalink
Updates (#16)
Browse files Browse the repository at this point in the history
* Update README.md

* move requirements file and split into testing and tutorials

* made extraneous files obsolete

* Updated requirements file location

* we don't support integration tests

* Rename SCHEMAS to CHANGELOG

* rename tutorial

* format with isort and black

* rename attr to attrs

* add tutorials

* updated tutorials

* Update README.md

* remove unnecessary files

* format with isort

* Delete README.md

* Update nx.ipynb

* Update TUTORIALS.md

* Update conftest.py

* Delete test_nx.py

* slight rename

* Fix code snippet

* Update README.md
  • Loading branch information
nwlandry authored Sep 26, 2024
1 parent 27bea43 commit 7aefda6
Show file tree
Hide file tree
Showing 26 changed files with 191,963 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install packages
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install -r requirements.txt
python -m pip install -r requirements/tests.txt
python -m pip list
- name: Test schema
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
## A set of Hypergraph Exchange Format (HIF) specification & validators
## The Hypergraph Interchange Format (HIF) standard
(Work-in-progress)

Hypergraph Exchange Format (HIF) is a forthcoming standard for data exchange between the existing hypergaph libraries.
Hypergraph Exchange Format (HIF) is a forthcoming standard for higher-order network data to facilitate seamless data exchange between existing higher-order network libraries.

### Table of contents for this folder

This repository is organized into the following folders:
* `examples`: This folder contains examples of higher-order datasets in the HIF standard. For details of its contents, see the [README](/examples/EXAMPLES.md).
* `requirements`: This folder contains a list of all dependencies used in this project.
* `schemas`: This folder contains all schemas used for specifying the HIF standard. For details of what has changed with each version, see the [CHANGELOG](/schemas/SCHEMAS.md).
* `src`: This folder contains addition functionality for checking against the HIF specification.
* `tests`: This folder contains all of the unit tests used for validating that the schema is correct.
* `tutorials`: This folder contains tutorials detailing how each library uses the HIF standard and how the HIF standard allows seamless integration between libraries. For details of its contents, see the [README](/examples/TUTORIALS.md).

Initial assumptions about the core of the HIF data format:
```
Expand All @@ -25,13 +35,7 @@ Initial assumptions about the core of the HIF data format:
- **direction keywords** : head, tail
- If a hypergraph is, for instance, directed, the edge direction will be contained in the incidences record with keyword "direction".
- Isolated nodes and empty edges are entries in "nodes" and "edges" which are not present in the incidences.

### Table of contents for this folder

This repository is organized into three folders:
* `examples`: This folder contains examples of higher-order datasets in the HIF standard. For details of its contents, see the [README](/examples/EXAMPLES.md).
* `schemas`: This folder contains all schemas used for specifying the HIF standard. For details of its contents, see the [README](/schemas/SCHEMAS.md).
* `scripts`: This folder contains scripts for checking that datasets match the HIF standard. For details of its contents, see the [README](/scripts/SCRIPTS.md).
- This schema explicitely describes all items in the schema using json objects and typing. This is a verbose presentation making it faster to instantiate than list-based schemas requiring a parser.

- *validate_hif.py*: This Python command line executable checks whether a JSON file matches the HIF standard. All errors print to the command line. More details on running this are in the [next section](#validate-files-against-the-hif-standard).

Expand All @@ -47,8 +51,9 @@ The only option is `--silent`, which suppresses all detailed warnings. Regardles
```python
import fastjsonschema
import json
import requests

schema = json.load(open("hif_schema_v0.1.0.json","r"))
schema = requests.get("https://raw.githubusercontent.com/pszufe/HIF_validators/main/schemas/hif_schema_v0.1.0.json").json()
validator = fastjsonschema.compile(schema)
hiftext = json.load(open(filename,'r'))
validator(hiftext)
Expand All @@ -66,10 +71,8 @@ The authors, co-authors or contributors of the following software libraries are
This project is an ongoing colaborative work of the following people (alphabetical order):
- [Audun Myers](https://www.audunmyers.com/) (Pacific Northwest National Laboratory)
- [Brenda Praggastis](https://www.pnnl.gov/people/brenda-praggastis) (Pacific Northwest National Laboratory)
- [Caterina Debacco](https://www.cdebacco.com/) (Max Planck Institute for Intelligent Systems)
- [Cliff Joslyn](https://www.pnnl.gov/people/cliff-joslyn) (Pacific Northwest National Laboratory)
- [Francesco Lotito](https://scholar.google.it/citations?user=_r_zQAwAAAAJ&hl=en) (University of Trento)
- [Martín Coll](https://about.me/mcoll) (University of Buenos Aires)
- [Nicholas Landry](https://nwlandry.com/) (University of Virginia)
- [Przemyslaw Szufel](https://szufel.pl/) (SGH Warsaw School of Economics)

- [Przemyslaw Szufel](https://szufel.pl/) (SGH Warsaw School of Economics)
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fastjsonschema
pytest
5 changes: 5 additions & 0 deletions requirements/tutorials.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
hypergraphx
hypernetx
networkx
xgi
requests
4 changes: 4 additions & 0 deletions schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changelog

## v0.1.0
Initial schema for the Hypergraph Interchange Format (HIF) standard.
17 changes: 0 additions & 17 deletions schemas/SCHEMAS.md

This file was deleted.

10 changes: 5 additions & 5 deletions schemas/hif_schema_v0.1.0.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/pszufe/HIF_validators/main/schemas/hif_schema_v0.1.0.json",
"title": "Schema for Hypergraph Interchange Format - HIF",
"title": "Hypergraph Interchange Format v0.1.0",
"type": "object",
"properties":{
"network-type": {
"enum": ["undirected","directed","asc"]
"enum": ["undirected","directed","asc"]
},
"metadata": {
"type":"object"
Expand All @@ -27,7 +27,7 @@
"direction": {
"enum": ["head","tail"]
},
"attr": {
"attrs": {
"type": "object"
},
"unevaluatedProperties": false
Expand All @@ -46,7 +46,7 @@
"weight": {
"type":"number"
},
"attr": {
"attrs": {
"type": "object"
} ,
"unevaluatedProperties": false
Expand All @@ -65,7 +65,7 @@
"weight": {
"type":"number"
},
"attr": {
"attrs": {
"type": "object"
} ,
"unevaluatedProperties": false
Expand Down
3 changes: 0 additions & 3 deletions scripts/SCRIPTS.md

This file was deleted.

1 change: 0 additions & 1 deletion scripts/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/nx.py

This file was deleted.

8 changes: 6 additions & 2 deletions scripts/hif.py → src/hif.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ def validate_network_type(data, verbose):
)

# in the case of simplicial complexes, make sure that the edges are maximal
if "network-type" in data and data["network-type"] == "asc" and "incidences" in data:
if (
"network-type" in data
and data["network-type"] == "asc"
and "incidences" in data
):
edgedict = defaultdict(set)
for record in data["incidences"]:
e = record[0]
Expand All @@ -31,4 +35,4 @@ def validate_network_type(data, verbose):
if verbose:
print(
f"Only maximal faces should be stored for simplicial complexes."
)
)
8 changes: 6 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json

import pytest
import requests
import fastjsonschema
import pytest

schema = "schemas/hif_schema_v0.1.0.json"
json_dir = "tests/test_files"
Expand All @@ -12,22 +11,27 @@
def validator():
return fastjsonschema.compile(json.load(open(schema)))


@pytest.fixture
def empty():
return json.load(open(f"{json_dir}/empty.json", "r"))


@pytest.fixture
def single_node():
return json.load(open(f"{json_dir}/single_node.json", "r"))


@pytest.fixture
def single_edge():
return json.load(open(f"{json_dir}/single_edge.json", "r"))


@pytest.fixture
def single_incidence():
return json.load(open(f"{json_dir}/single_incidence.json", "r"))


@pytest.fixture
def bad_top_level_field():
return json.load(open(f"{json_dir}/bad_top_level_field.json", "r"))
Expand Down
26 changes: 0 additions & 26 deletions tests/test_nx.py

This file was deleted.

7 changes: 7 additions & 0 deletions tutorials/TUTORIALS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# List of tutorials

* `integration.ipynb`: This tutorial demonstrates how to use the HIF standard to facilitate data exchange between different libraries.
* `hgx.ipynb`:
* `hnx.ipynb`:
* `nx.ipynb`:
* `xgi.ipynb`: This tutorial demonstrates how to use the HIF functionality available in XGI
Loading

0 comments on commit 7aefda6

Please sign in to comment.