Skip to content

Commit

Permalink
V0.1.1 (#16)
Browse files Browse the repository at this point in the history
* moved unique edge size function from hypergraph class and fixed bug.

* update version

* Fixed small documentation issue

* fixed numpy dependency

* update long description
  • Loading branch information
nwlandry authored Dec 1, 2021
1 parent d51408a commit be17ce4
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ cff-version: "1.1.0"
license: "BSD-3"
message: "If you use this software, please cite it using these metadata."
title: XGI
version: "0.1"
version: "0.1.1"
...
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To get started, take a look at the [tutorials](/tutorials/) illustrating the lib

## Documentation

For more documentation, see our [Read The Docs](https://xgi.readthedocs.io/en/latest/) page
For more documentation, see our [Read The Docs](https://xgi.readthedocs.io/en/latest/) page.

## Contributing
Contributions are always welcome. Please report any bugs that you find [here](../../issues). Or, even better, fork the repository on [GitHub](../../) and create a pull request (PR). We welcome all changes, big or small, and we will help you make the PR if you are new to `git` (just ask on the issue and/or see our [contributing guidelines](CONTRIBUTING.md)).
Expand All @@ -60,16 +60,18 @@ a citation in your preferred format, and will also integrate well with citation
Our full code of conduct, and how we enforce it, can be read in [our repository](CODE_OF_CONDUCT.md).

## License
Released under the 3-Clause BSD license (see `license.md`)
Released under the 3-Clause BSD license (see [`license.md`](license.md))

Copyright (C) 2021 XGI Developers

Nicholas Landry <[email protected]>

Leo Torres <[email protected]>

The XGI library has copied or modified code from the HyperNetX and NetworkX libraries, the licenses of which can be found in our [license file](license.md)

## Funding
The XGI package has been supported by NSF Grant 2121905, ["HNDS-I: Using Hypergraphs to Study Spreading Processes in Complex Social Networks"](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2121905)
The XGI package has been supported by NSF Grant 2121905, ["HNDS-I: Using Hypergraphs to Study Spreading Processes in Complex Social Networks"](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2121905).

## Other resources
This library may not meet your needs and if this is this case, consider checking out these other resources:
Expand Down
5 changes: 3 additions & 2 deletions docs/source/about.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
About
=====

.. image:: ../../logo/logo.svg
:width: 200

The ``XGI`` library provides data structures and algorithms for modeling and analyzing
complex systems with group (higher-order) interactions.

Expand Down Expand Up @@ -30,15 +33,13 @@ installed by ``pip`` during the installation process

License
-------

This project is licensed under the `BSD 3-Clause License
<https://github.com/ComplexGroupInteractions/xgi/blob/main/LICENSE.md>`__.
Note that this excludes any images/pictures/figures shown here or in the
documentation.

Contributing
------------

If you want to contribute to this project, please make sure to read the
`code of conduct
<https://github.com/ComplexGroupInteractions/xgi/blob/main/CODE_OF_CONDUCT.md>`__
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = "Nicholas W. Landry and Leo Torres"

# The full version, including alpha/beta/rc tags
release = "0.1"
release = "0.1.1"

# -- General configuration ---------------------------------------------------

Expand Down
7 changes: 5 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
=======
===
XGI
=======
===

.. image:: ../../logo/logo.svg
:width: 200

Description
-----------
Expand Down
74 changes: 74 additions & 0 deletions long_description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
XGI
===

.. image:: https://github.com/ComplexGroupInteractions/xgi/blob/main/logo/logo.svg
:width: 200

CompleX Group Interactions (XGI) is a Python package for the representation, manipulation,
and study of the structure, dynamics, and functions of complex systems with group (higher-order) interactions.

- **Source**: https://github.com/ComplexGroupInteractions/xgi
- **Bug reports**: https://github.com/ComplexGroupInteractions/xgi/issues
- **GitHub Discussions**: https://github.com/ComplexGroupInteractions/xgi/discussions
- **Documentation**: https://xgi.readthedocs.io/en/latest/

Installation
------------
XGI runs on Python 3.7 or higher.

To install the latest version of XGI, run the following command
.. code:: bash
pip install xgi
To install this package locally:
- Clone this repository
- Navigate to the folder on your local machine
- Run the following command
.. code:: bash
pip install -e .["all"]
Getting Started
---------------
To get started, take a look at the `tutorials <https://github.com/ComplexGroupInteractions/xgi/tree/main/tutorials>`_
illustrating the library's basic functionality.

Documentation
-------------
For more documentation, see our `Read The Docs <https://xgi.readthedocs.io/en/latest/>`_ page.

Contributing
------------
Contributions are always welcome. Please report any bugs that you find `here <https://github.com/ComplexGroupInteractions/xgi/issues>`_.
Or, even better, fork the repository on `GitHub <https://github.com/ComplexGroupInteractions/xgi>`_ and create a pull request (PR).
We welcome all changes, big or small, and we will help you make the PR if you are new to `git`
(just ask on the issue and/or see our `contributing guidelines <https://github.com/ComplexGroupInteractions/xgi/tree/main/CONTRIBUTING.md>`_.

How to Cite
-----------
We acknowledge the importance of good software to support research, and we note
that research becomes more valuable when it is communicated effectively. To
demonstrate the value of XGI, we ask that you cite XGI in your work.
Currently, the best way to cite XGI is to go to our
`repository page <https://github.com/ComplexGroupInteractions/xgi>`_ and
click the "cite this repository" button on the right sidebar. This will generate
a citation in your preferred format, and will also integrate well with citation managers.

Code of Conduct
---------------
Our full code of conduct, and how we enforce it, can be read in `our repository <https://github.com/ComplexGroupInteractions/xgi/tree/main/CODE_OF_CONDUCT.md>`_.

License
-------
Released under the 3-Clause BSD license (see the `license file <https://github.com/ComplexGroupInteractions/xgi/tree/main/license.md>`_)

Copyright (C) 2021 XGI Developers

Nicholas Landry <[email protected]>

Leo Torres <[email protected]>

The XGI library has copied or modified code from the HyperNetX and NetworkX libraries, the licenses of which can be found in the
`license file <https://github.com/ComplexGroupInteractions/xgi/tree/main/license.md>`_.
9 changes: 4 additions & 5 deletions requirements/default.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
numpy>=1.19
scipy>=1.5,!=1.6.1
pandas>=1.1
networkx>=2.5
python>=3.7
networkx>=2.2
numpy>=1.19,<1.22
scipy>=1.5
pandas>=1.0
1 change: 1 addition & 0 deletions requirements/doc.txt → requirements/documentation.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sphinx~=4.0
sphinx-rtd-theme>=0.4.2
numpydoc>=1.1
pillow>=8.2
File renamed without changes.
40 changes: 21 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup
import sys

__version__ = "0.1"
__version__ = "0.1.1"

if sys.version_info < (3, 7):
sys.exit("XGI requires Python 3.7 or later.")
Expand All @@ -18,37 +18,38 @@
"xgi.utils",
]

version = "0.1"
version = "0.1.1"

authors = "Nicholas Landry and Leo Torres"

author_email = "[email protected]"

url = "https://github.com/ComplexGroupInteractions/xgi"

description = "XGI is a Python library for the representation and analysis of complex systems with group (higher-order) interaction."
description = """XGI is a Python library for the representation
and analysis of complex systems with group (higher-order) interactions."""

install_requires = [
"networkx>=2.2,<3.0",
"numpy>=1.15.0,<2.0",
"scipy>=1.1.0,<2.0",
"pandas>=0.23",
]
with open("long_description.rst") as file:
long_description = file.read()


def parse_requirements_file(filename):
with open(filename) as fid:
requires = [l.strip() for l in fid.readlines() if not l.startswith("#")]
return requires

license = "3-Clause BSD license"

extras_require = {
"testing": ["pytest>=4.0"],
"tutorials": ["jupyter>=1.0"],
"documentation": ["sphinx>=1.8.2", "sphinx-rtd-theme>=0.4.2"],
"all": [
"sphinx>=1.8.2",
"sphinx-rtd-theme>=0.4.2",
"pytest>=4.0",
"jupyter>=1.0",
],
dep: parse_requirements_file("requirements/" + dep + ".txt")
for dep in ["developer", "documentation", "release", "test", "tutorial"]
}

extras_require["all"] = list({item for dep in extras_require.values() for item in dep})

install_requires = parse_requirements_file("requirements/default.txt")

license = "3-Clause BSD license"

setup(
name=name,
packages=packages,
Expand All @@ -57,6 +58,7 @@
author_email=author_email,
url=url,
description=description,
long_description=long_description,
install_requires=install_requires,
extras_require=extras_require,
)
24 changes: 24 additions & 0 deletions xgi/classes/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"""

from collections import Counter
import numpy as np
import xgi

__all__ = [
"degree_histogram",
"unique_edge_sizes",
"freeze",
"is_frozen",
"create_empty_copy",
Expand Down Expand Up @@ -48,6 +50,28 @@ def degree_histogram(H):
return [counts.get(i, 0) for i in range(max(counts) + 1)]


def unique_edge_sizes(H, return_counts=False):
"""A function that returns the unique edge sizes.
Parameters
----------
H : Hypergraph object
The hypergraph of interest
return_counts : bool, default: False
Specifies whether to include the number of occurences of that edge size
Returns
-------
if return_counts:
numpy.ndarray, numpy.ndarray
Numpy arrays of the unique edge sizes and the number of each size respectively
else:
numpy.ndarray
A numpy array of the unique edge sizes
"""
return np.unique(list(H.edge_size), return_counts=return_counts)


def frozen(*args, **kwargs):
"""Dummy method that raises an error when trying to modify frozen hypergraphs
Expand Down
24 changes: 2 additions & 22 deletions xgi/classes/hypergraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

class Hypergraph:
"""A class to represent undirected hypergraphs."""

node_dict_factory = dict
node_attr_dict_factory = dict
hyperedge_dict_factory = dict
Expand Down Expand Up @@ -883,25 +884,6 @@ def edge_size(self):
"""
return EdgeSizeView(self)

def unique_edge_sizes(self, return_counts=False):
"""A function that returns the unique edge sizes.
Parameters
----------
return_counts : bool, default: False
Specifies whether to include the number of occurences of that edge size
Returns
-------
if return_counts:
numpy.ndarray, numpy.ndarray
Numpy arrays of the unique edge sizes and the number of each size respectively
else:
numpy.ndarray
A numpy array of the unique edge sizes
"""
return np.unique(list(self.edge_degree), return_counts=return_counts)

def clear(self):
"""Remove all nodes and edges from the graph.
Expand Down Expand Up @@ -1159,9 +1141,7 @@ def bunch_iter(nlist, nodes):
exc, message = e, e.args[0]
# capture error for non-sequence/iterator nbunch.
if "iter" in message:
exc = XGIError(
"nbunch is not a node or a sequence of nodes."
)
exc = XGIError("nbunch is not a node or a sequence of nodes.")
# capture error for unhashable node.
if "hashable" in message:
exc = XGIError(
Expand Down
7 changes: 4 additions & 3 deletions xgi/classes/hypergraphviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
"""



import xgi

__all__ = ["generic_hypergraph_view", "subhypergraph_view"]


def generic_hypergraph_view(H, create_using=None):
"""Create a read-only view of the hypergraph
The read-only view shares the same memory as the original hypergraph
and "freezes" the hypergraph by removing the methods that can modify
the hypergraph.
Expand Down Expand Up @@ -100,6 +99,8 @@ def subhypergraph_view(H, filtered_nodes=None, filtered_edges=None):
newH._edge_attr = {edge: H._edge_attr[edge] for edge in newH._edge}

# Add the filtered nodes with connections to the remaining edges after filtering
newH._node = {node: set(H._node[node]).intersection(newH._edge.keys()) for node in nodes}
newH._node = {
node: set(H._node[node]).intersection(newH._edge.keys()) for node in nodes
}
newH._node_attr = {node: H._node_attr[node] for node in nodes}
return newH
2 changes: 1 addition & 1 deletion xgi/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contains information about this package.
"""

__version__ = "0.1"
__version__ = "0.1.1"

__author__ = "Nicholas W. Landry and Leo Torres"
__copyright__ = "Copyright 2021-2022, " + __author__
Expand Down
2 changes: 1 addition & 1 deletion xgi/readwrite/bipartite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import xgi
import xgi
from xgi.exception import XGIError

__all__ = [
Expand Down

0 comments on commit be17ce4

Please sign in to comment.