-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1c8c0b
commit 42b8bb6
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from StructuralGT.util import _Compute | ||
import numpy as np | ||
|
||
class AverageNodalConnectivity(_Compute): | ||
"""A module solely for calculating the average nodal connectivity. | ||
Written separately because it is computationally very expensive, yet has | ||
been shown to correlate well with material properties.REF | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def compute(self): | ||
"""Computes the average nodal connectivity.""" | ||
from StructuralGT import _average_nodal_connectivity_cast | ||
_copy = copy.deepcopy(self.Gr) | ||
|
||
cast = _average_nodal_connectivity_cast.PyCast(_copy._raw_pointer()) | ||
|
||
cast.average_nodal_connectivity_compute() | ||
|
||
self._average_nodal_connectivity = cast.average_nodal_connectivity | ||
|
||
@_Compute._computed_property | ||
def average_nodal_connectivity(self): | ||
r"""The nodal connectivity $\kappa(i,j)$, is the minimum number of edges | ||
that would need to be removed to disconnect nodes $i$ and $j$. The | ||
average nodal connectivity is the connectivity value averaged over all | ||
pairs of nodes: | ||
.. math:: | ||
\bar{\kappa} = 2\frac{\sum_{i \neq j}\kappa(i,j)}{n(n-1)} | ||
""" | ||
return self._average_nodal_connectivity |