Skip to content

Commit

Permalink
Merge pull request #41 from pnnl/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
brendapraggastis authored Sep 8, 2020
2 parents 8be77dc + 672abb0 commit 1ffe17c
Show file tree
Hide file tree
Showing 34 changed files with 126 additions and 60 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,20 @@ Tutorials may be run in your browser using Google Colab
<a href="https://colab.research.google.com/github/pnnl/HyperNetX/blob/master/tutorials/Tutorial%202%20-%20Visualization%20Methods.ipynb" target="_blank">



<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
<span style={'margin-left':5px}>Tutorial 2 - Visualization Methods</span>
</a>
</br>
<a href="https://colab.research.google.com/github/pnnl/HyperNetX/blob/master/tutorials/Tutorial%203%20-%20LesMis%20Case%20Study.ipynb" target="_blank">



<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
<span style={'margin-left':5px}>Tutorial 3 - LesMis Case Study</span>
</a>
</br>
<a href="https://colab.research.google.com/github/pnnl/HyperNetX/blob/master/tutorials/Tutorial%204%20-%20LesMis%20Visualizations-BookTour.ipynb" target="_blank">



<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
<span style={'margin-left':5px}>Tutorial 4 - LesMis Visualizations-Book Tour</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 100d5f0571659fa080bb0f6ef7eebc72
config: 12513d66143dfa27e7a4e78bbb5b3696
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/build/.doctrees/algorithms/algorithms.doctree
Binary file not shown.
Binary file modified docs/build/.doctrees/environment.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/_modules/algorithms/homology_mod2.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>algorithms.homology_mod2 &mdash; HyperNetX 0.3.4 documentation</title>
<title>algorithms.homology_mod2 &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
30 changes: 27 additions & 3 deletions docs/build/_modules/algorithms/s_centrality_measures.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>algorithms.s_centrality_measures &mdash; HyperNetX 0.3.4 documentation</title>
<title>algorithms.s_centrality_measures &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down Expand Up @@ -161,7 +161,22 @@
<h1>Source code for algorithms.s_centrality_measures</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright © 2018 Battelle Memorial Institute</span>
<span class="c1"># All rights reserved.</span>
<span class="c1"># This module developed for PNNL&#39;s hyperbio LDRD project summer 2019</span>

<span class="sd">&quot;&quot;&quot;</span>

<span class="sd">S-Centrality Measures</span>
<span class="sd">=====================</span>
<span class="sd">We generalize graph metrics to s-metrics for a hypergraph by using its s-connected</span>
<span class="sd">components. This is accomplished by computing the s edge-adjacency matrix and</span>
<span class="sd">constructing the corresponding graph of the matrix. We then use existing graph metrics</span>
<span class="sd">on this representation of the hypergraph. In essence we construct an *s*-line graph</span>
<span class="sd">corresponding to the hypergraph on which to apply our methods.</span>

<span class="sd">S-Metrics for hypergraphs are discussed in depth in: </span>
<span class="sd">*Aksoy, S.G., Joslyn, C., Ortiz Marrero, C. et al. Hypernetwork science via high-order hypergraph walks.</span>
<span class="sd">EPJ Data Sci. 9, 16 (2020). https://doi.org/10.1140/epjds/s13688-020-00231-0*</span>

<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="k">import</span> <span class="n">defaultdict</span>
Expand Down Expand Up @@ -193,10 +208,12 @@ <h1>Source code for algorithms.s_centrality_measures</h1><div class="highlight">
<span class="sd"> A dictionary of s-betweenness centrality value of the edges.</span>

<span class="sd"> &#39;&#39;&#39;</span>

<span class="c1"># Confirm there is at least 1 s edge for which we can compute the centrality</span>
<span class="c1"># Find all s-edges</span>
<span class="c1">#M,rdict,_ = H.incidence_matrix(index=True)</span>
<span class="c1">#A = M.transpose().dot(M)</span>

<span class="n">A</span><span class="p">,</span> <span class="n">coldict</span> <span class="o">=</span> <span class="n">H</span><span class="o">.</span><span class="n">edge_adjacency_matrix</span><span class="p">(</span><span class="n">s</span><span class="o">=</span><span class="n">s</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">A</span><span class="o">.</span><span class="n">setdiag</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="n">A</span> <span class="o">=</span> <span class="p">(</span><span class="n">A</span> <span class="o">&gt;=</span> <span class="n">s</span><span class="p">)</span> <span class="o">*</span> <span class="mi">1</span>
Expand Down Expand Up @@ -227,8 +244,10 @@ <h1>Source code for algorithms.s_centrality_measures</h1><div class="highlight">
<span class="sd"> If edge then a single value is returned.</span>

<span class="sd"> &#39;&#39;&#39;</span>

<span class="c1"># Confirm there is at least 1 s edge for which we can compute the centrality</span>
<span class="c1"># Find all s-edges</span>

<span class="k">if</span> <span class="n">edge</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">[</span><span class="n">edge</span><span class="p">])</span> <span class="o">&lt;</span> <span class="n">s</span><span class="p">:</span>
<span class="k">return</span> <span class="mi">0</span>

Expand All @@ -250,6 +269,7 @@ <h1>Source code for algorithms.s_centrality_measures</h1><div class="highlight">

<span class="c1"># confirm there are at least 2 s-edges</span>
<span class="c1"># we follow the NX convention that the s-closeness centrality of a single edge Hypergraph is 0</span>

<span class="n">output</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">bool</span><span class="p">(</span><span class="n">Es</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">Es</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">output</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="p">:</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">edges</span><span class="p">}</span>
Expand Down Expand Up @@ -280,7 +300,11 @@ <h1>Source code for algorithms.s_centrality_measures</h1><div class="highlight">
<span class="sd"> eccentricity[f] : float</span>
<span class="sd"> else:</span>
<span class="sd"> eccentricity_dict : dict</span>
<span class="sd"> </span>
<span class="sd"> : dict or float</span>
<span class="sd"> returns the s-eccentricity value of the edges, a floating point number</span>
<span class="sd"> If edge=None a dictionary of values for each s-edge in H is returned.</span>
<span class="sd"> If edge then a single value is returned.</span>

<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="n">f</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">Entity</span><span class="p">):</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/classes/entity.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>classes.entity &mdash; HyperNetX 0.3.4 documentation</title>
<title>classes.entity &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/classes/hypergraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>classes.hypergraph &mdash; HyperNetX 0.3.4 documentation</title>
<title>classes.hypergraph &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/drawing/rubber_band.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>drawing.rubber_band &mdash; HyperNetX 0.3.4 documentation</title>
<title>drawing.rubber_band &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/drawing/two_column.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>drawing.two_column &mdash; HyperNetX 0.3.4 documentation</title>
<title>drawing.two_column &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/drawing/util.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>drawing.util &mdash; HyperNetX 0.3.4 documentation</title>
<title>drawing.util &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Overview: module code &mdash; HyperNetX 0.3.4 documentation</title>
<title>Overview: module code &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_modules/reports/descriptive_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>reports.descriptive_stats &mdash; HyperNetX 0.3.4 documentation</title>
<title>reports.descriptive_stats &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.3.4',
VERSION: '0.3.5',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
30 changes: 26 additions & 4 deletions docs/build/algorithms/algorithms.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>algorithms package &mdash; HyperNetX 0.3.4 documentation</title>
<title>algorithms package &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down Expand Up @@ -101,7 +101,10 @@
<li class="toctree-l4"><a class="reference internal" href="#homology-and-smith-normal-form">Homology and Smith Normal Form</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-algorithms.s_centrality_measures">algorithms.s_centrality_measures module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-algorithms.s_centrality_measures">algorithms.s_centrality_measures module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#s-centrality-measures">S-Centrality Measures</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-algorithms">Module contents</a></li>
</ul>
</li>
Expand Down Expand Up @@ -599,6 +602,16 @@ <h4>Homology Mod2<a class="headerlink" href="#homology-mod2" title="Permalink to
</div>
<div class="section" id="module-algorithms.s_centrality_measures">
<span id="algorithms-s-centrality-measures-module"></span><h2>algorithms.s_centrality_measures module<a class="headerlink" href="#module-algorithms.s_centrality_measures" title="Permalink to this headline"></a></h2>
<div class="section" id="s-centrality-measures">
<h3>S-Centrality Measures<a class="headerlink" href="#s-centrality-measures" title="Permalink to this headline"></a></h3>
<p>We generalize graph metrics to s-metrics for a hypergraph by using its s-connected
components. This is accomplished by computing the s edge-adjacency matrix and
constructing the corresponding graph of the matrix. We then use existing graph metrics
on this representation of the hypergraph. In essence we construct an <em>s</em>-line graph
corresponding to the hypergraph on which to apply our methods.</p>
<p>S-Metrics for hypergraphs are discussed in depth in:
<em>Aksoy, S.G., Joslyn, C., Ortiz Marrero, C. et al. Hypernetwork science via high-order hypergraph walks.
EPJ Data Sci. 9, 16 (2020). https://doi.org/10.1140/epjds/s13688-020-00231-0</em></p>
<dl class="function">
<dt id="algorithms.s_centrality_measures.s_betweenness_centrality">
<code class="sig-prename descclassname">algorithms.s_centrality_measures.</code><code class="sig-name descname">s_betweenness_centrality</code><span class="sig-paren">(</span><em class="sig-param">H</em>, <em class="sig-param">s=1</em>, <em class="sig-param">normalized=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/algorithms/s_centrality_measures.html#s_betweenness_centrality"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#algorithms.s_centrality_measures.s_betweenness_centrality" title="Permalink to this definition"></a></dt>
Expand Down Expand Up @@ -630,10 +643,18 @@ <h4>Homology Mod2<a class="headerlink" href="#homology-mod2" title="Permalink to
<p>H : Hypergraph
f : Entity or str
s : int</p>
<dl class="simple">
<dl>
<dt>if f:</dt><dd><p>eccentricity[f] : float</p>
</dd>
<dt>else:</dt><dd><p>eccentricity_dict : dict</p>
<dt>else:</dt><dd><blockquote>
<div><p>eccentricity_dict : dict</p>
</div></blockquote>
<dl class="simple">
<dt>: dict or float</dt><dd><p>returns the s-eccentricity value of the edges, a floating point number
If edge=None a dictionary of values for each s-edge in H is returned.
If edge then a single value is returned.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -664,6 +685,7 @@ <h4>Homology Mod2<a class="headerlink" href="#homology-mod2" title="Permalink to
</div></blockquote>
</dd></dl>

</div>
</div>
<div class="section" id="module-algorithms">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-algorithms" title="Permalink to this headline"></a></h2>
Expand Down
7 changes: 5 additions & 2 deletions docs/build/algorithms/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>algorithms &mdash; HyperNetX 0.3.4 documentation</title>
<title>algorithms &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down Expand Up @@ -178,7 +178,10 @@ <h1>algorithms<a class="headerlink" href="#algorithms" title="Permalink to this
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="algorithms.html#module-algorithms.s_centrality_measures">algorithms.s_centrality_measures module</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithms.html#module-algorithms.s_centrality_measures">algorithms.s_centrality_measures module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="algorithms.html#s-centrality-measures">S-Centrality Measures</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="algorithms.html#module-algorithms">Module contents</a></li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/classes/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>classes package &mdash; HyperNetX 0.3.4 documentation</title>
<title>classes package &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/classes/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>classes &mdash; HyperNetX 0.3.4 documentation</title>
<title>classes &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/drawing/drawing.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>drawing package &mdash; HyperNetX 0.3.4 documentation</title>
<title>drawing package &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/drawing/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>drawing &mdash; HyperNetX 0.3.4 documentation</title>
<title>drawing &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Index &mdash; HyperNetX 0.3.4 documentation</title>
<title>Index &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/glossary.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Glossary of HNX terms &mdash; HyperNetX 0.3.4 documentation</title>
<title>Glossary of HNX terms &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>HyperNetX (HNX) &mdash; HyperNetX 0.3.4 documentation</title>
<title>HyperNetX (HNX) &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Installing HyperNetX &mdash; HyperNetX 0.3.4 documentation</title>
<title>Installing HyperNetX &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>License &mdash; HyperNetX 0.3.4 documentation</title>
<title>License &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/overview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Overview &mdash; HyperNetX 0.3.4 documentation</title>
<title>Overview &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Python Module Index &mdash; HyperNetX 0.3.4 documentation</title>
<title>Python Module Index &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/reports/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>reports &mdash; HyperNetX 0.3.4 documentation</title>
<title>reports &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/build/reports/reports.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>reports package &mdash; HyperNetX 0.3.4 documentation</title>
<title>reports package &mdash; HyperNetX 0.3.5 documentation</title>



Expand Down
Loading

0 comments on commit 1ffe17c

Please sign in to comment.