Skip to content

Commit

Permalink
Pull request #226: updates to documentation & Updated Factory dict me…
Browse files Browse the repository at this point in the history
…thod to deepcopy dict

Merge in HYP/hypernetx from updating-documentation to master

* commit 'd7b2c06e019ef79259ebfe4071ac25bfdb2fc91d':
  bump: version 2.3.12 → 2.3.13
  Updating factory dict method to deepcopy dict
  updates to documentation
  • Loading branch information
amyersppnl authored and ryandanehy committed Jan 31, 2025
2 parents 17484bf + d7b2c06 commit bc07b3e
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .cz.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.commitizen]
name = "cz_conventional_commits"
version = "2.3.12"
version = "2.3.13"
version_provider = "poetry"
version_files = [
"pyproject.toml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Modularity and Clustering
=========================

.. image:: images/ModularityScreenShot.png
.. image:: ../images/ModularityScreenShot.png
:width: 300px
:align: right

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
import os


__version__ = "2.3.12"
__version__ = "2.3.13"


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("../../hypernetx"))

sys.path.insert(0, os.path.abspath("../.."))

# -- Project information -----------------------------------------------------

Expand Down
24 changes: 19 additions & 5 deletions docs/source/core.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
.. _core:

==================
HyperNetX Packages
HyperNetX
==================

HyperNetX is a Python package designed for the creation, manipulation, and analysis of hypergraphs. This documentation provides a detailed reference for the core components of the library. These components are:

* **Hypergraphs:** This section documents the core data structures and classes used to represent hypergraphs within HyperNetX. It includes detailed API documentation for classes such as `Hypergraph`, `PropertyStore`, `IncidenceStore`, and `HypergraphView`, along with their associated methods and attributes.

* **Algorithms:** This section documents the algorithms implemented in HyperNetX for analyzing hypergraphs. It provides API documentation for functions related to connectivity, distance, centrality, community detection, and other hypergraph metrics.

* **Drawing:** This section documents the tools provided by HyperNetX for visualizing hypergraphs. It includes API documentation for functions and classes related to layout algorithms, rendering options, and other visualization utilities.

* **Reports:** This section documents the functionality for generating reports and summaries of hypergraph data. It provides API documentation for functions that calculate statistical information and other relevant metrics.

For detailed API documentation of each component, please explore the following sections:

.. toctree::
:maxdepth: 1
:titlesonly:

Hypergraphs <classes/modules.rst>
Algorithms <algorithms/modules.rst>
Drawing <drawing/modules.rst>
Reports <reports/modules.rst>
Hypergraphs <classes/modules.rst>
Algorithms <algorithms/modules.rst>
Drawing <drawing/modules.rst>
Reports <reports/modules.rst>
27 changes: 0 additions & 27 deletions docs/source/glossary.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
.. _glossary:

===================
HNX Data Structures
===================

.. figure:: images/code_structure.png
:width: 300px
:align: right

Code structure for HNX.

The HNX library centers around the idea of a :term:`hypergraph`.
There are many definitions of a *hypergraph*. In HNX a hypergraph
is a tuple of three sets, :math:`H = (V, E, \mathcal{I})`.

- :math:`V`, a set of *nodes* (aka hypernodes, vertices), distinguished by unique identifiers
- :math:`E` a set of *edges* (aka hyperedges), distinguished by unique identifiers
- :math:`\mathcal{I}`, a set of *incidences*, which form a subset of :math:`E \times V`, distinguished by the pairing of unique identifiers of edges in :math:`E` and nodes in :math:`V`

The incidences :math:`\mathcal{I}` can be described by a Boolean function, :math:`\mathcal{I}_B : E \times V \rightarrow \{0, 1\}`, indicating whether or not a pair is included in the hypergraph.

In HNX we instantiate :math:`H = (V, E, \mathcal{I})` using three *hypergraph views.* We can visualize this through a high
level diagram of our current code structure shown in Fig. 1. Here we begin with data (e.g., data frame, dictionary,
list of lists, etc.) that is digested via the appropriate factory method to construct property stores for nodes,
edges, and incidences as well as an incidence store that captures the hypergraph structure.
These four objects are then used to create three hypergraph views that the hypergraph object
uses to access and analyze the hypergraph structure and attributes.


=====================
Glossary of HNX terms
Expand Down
31 changes: 31 additions & 0 deletions docs/source/hnx_data_structures.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

.. _hypconstructors:


===================
HNX Data Structures
===================

.. figure:: images/code_structure.png
:width: 300px
:align: right

Code structure for HNX.

The HNX library centers around the idea of a :term:`hypergraph`.
There are many definitions of a *hypergraph*. In HNX a hypergraph
is a tuple of three sets, :math:`H = (V, E, \mathcal{I})`.

- :math:`V`, a set of *nodes* (aka hypernodes, vertices), distinguished by unique identifiers
- :math:`E` a set of *edges* (aka hyperedges), distinguished by unique identifiers
- :math:`\mathcal{I}`, a set of *incidences*, which form a subset of :math:`E \times V`, distinguished by the pairing of unique identifiers of edges in :math:`E` and nodes in :math:`V`

The incidences :math:`\mathcal{I}` can be described by a Boolean function, :math:`\mathcal{I}_B : E \times V \rightarrow \{0, 1\}`, indicating whether or not a pair is included in the hypergraph.

In HNX we instantiate :math:`H = (V, E, \mathcal{I})` using three *hypergraph views.* We can visualize this through a high
level diagram of our current code structure shown in Fig. 1. Here we begin with data (e.g., data frame, dictionary,
list of lists, etc.) that is digested via the appropriate factory method to construct property stores for nodes,
edges, and incidences as well as an incidence store that captures the hypergraph structure.
These four objects are then used to create three hypergraph views that the hypergraph object
uses to access and analyze the hypergraph structure and attributes.

2 changes: 2 additions & 0 deletions docs/source/hypconstructors.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

.. _hypconstructors:



=======================
Hypergraph Constructors
=======================
Expand Down
4 changes: 1 addition & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ Contents
Home <self>
overview/index
install
Glossary <glossary>
introduction
core
A Gentle Introduction to Hypergraph Mathematics <hypergraph101>
Hypergraph Constructors <hypconstructors>
Visualization Widget <widget>
Modules <modules>
Publications <publications>
Expand Down
4 changes: 4 additions & 0 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Installing HyperNetX
The recommended installation method for most users is to create a virtual environment
and install HyperNetX from PyPi.

.. code-block:: bash
pip install hypernetx
.. _Github: https://github.com/pnnl/HyperNetX

HyperNetX may be cloned or forked from Github_.
Expand Down
26 changes: 26 additions & 0 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. _introduction:

********************
Introduction
********************


This documentation provides a comprehensive guide to the HyperNetworkX (HNX) library, a Python package for working with hypergraphs. This guide covers the mathematical foundations of hypergraphs, the key terminology used within HNX, the core data structures employed by the library, and practical methods for constructing hypergraphs. Specifically:

* **A Gentle Introduction to Hypergraph Mathematics:** This section provides a basic introduction to hypergraphs, explaining how they generalize traditional graphs and introducing key concepts like hyperedges, incidence matrices, and the duality of hypergraphs. It focuses on "gentle" hypergraphs (simple, finite, connected, etc.) to build a solid foundation before touching on more complex topics.

* **Glossary of HNX Terms:** This section offers a comprehensive glossary of terms used throughout the HNX library documentation. It defines key concepts related to hypergraphs, such as nodes, edges, incidences, various types of adjacency, connectivity, and distance, as well as HNX-specific terms like PropertyStore, IncidenceStore, and HypergraphView.

* **Data Structures:** This section describes the core data structures used within the HNX library to represent and manage hypergraphs. It explains how these structures organize nodes, edges, and incidences, and how they facilitate efficient access and manipulation of hypergraph data.

* **Hypergraph Constructors:** This section details the various ways to construct hypergraphs using the HNX library. It explains how to create hypergraphs from different data structures, including lists of lists, dictionaries, and Pandas DataFrames, and describes how to associate metadata and properties with nodes, edges, and incidences.

For more detailed information on each of these areas, please explore the following sections:

.. toctree::
:maxdepth: 2

A Gentle Introduction to Hypergraph Mathematics <hypergraph101>
Glossary <glossary>
Data Structures <hnx_data_structures>
Hypergraph Constructors <hypconstructors>
2 changes: 1 addition & 1 deletion hypernetx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
from hypernetx.utils import *
from hypernetx.utils.toys import *

__version__ = "2.3.12"
__version__ = "2.3.13"
8 changes: 4 additions & 4 deletions hypernetx/classes/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd

import copy
from hypernetx import HyperNetXError


Expand Down Expand Up @@ -183,7 +183,7 @@ def dict_to_incidence_store_df(D):


def dict_factory_method(
D,
Dct,
level,
use_indices=False,
uid_cols=None,
Expand All @@ -199,7 +199,7 @@ def dict_factory_method(
Parameters
----------
D : dictionary
Dct : dictionary
dictionary of properties for either incidences, edges, or nodes
level : int
Expand Down Expand Up @@ -233,7 +233,7 @@ def dict_factory_method(
Pandas Dataframe of the property store in the correct format for HNX.
'''

D = copy.deepcopy(Dct)
# if no dictionary is provided set it to an empty dictionary.
if D is None:
DF = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hypernetx"
version = "2.3.12"
version = "2.3.13"
description = "HyperNetX is a Python library for the creation and study of hypergraphs."
authors = ["Brenda Praggastis <Brenda.Praggastis@pnnl.gov>", "Dustin Arendt <dustin.arendt@pnnl.gov>",
"Sinan Aksoy <sinan.aksoy@pnnl.gov>", "Emilie Purvine <Emilie.Purvine@pnnl.gov>",
Expand Down

0 comments on commit bc07b3e

Please sign in to comment.