DigplexQ is a Python package for performing computations on digraph-based complexes, including directed flag complexes and path complexes. It is designed as an adjacency-matrix-centered package, allowing users to perform all computations directly from an adjacency matrix without requiring explicit construction of the underlying complex.
The package implements a range of quantitative methods for analyzing digraph-based complexes, primarily based on concepts from directed Q-analysis. At present, the implementation focuses exclusively on lower q-adjacency.
- Free software: MIT license
- Documentation: Documentation
pip3 install digplexqfrom digplexq.directed_q_analysis import *
from digplexq.digraph_based_complexes import *
from digplexq.structure_based_simplicial_measures import *
from digplexq.random_digraphs import *
from digplexq.utils import *
M = directed_erdos_renyi_GnM_model(20, 40, weight=False)
M = remove_double_edges(M) #remove double edges.
#Directed flag complex:
DFC = DirectedFlagComplex(M, "by_dimension_with_nodes")
#Maximal directed simplices:
maxsimp = MaximalSimplices(DFC)
#Lower q-Adjacency matrix:
fast_q_adjacency_matrix(M, q=1)
#in-q-degree centrality
in_q_degree_centrality(M, q=1, results="nodes")More examples are available in the Jupyter Notebook.
For versions prior to v0.0.8, you may encounter the following errors:
AttributeError: module 'networkx' has no attribute 'from_numpy_matrix'
AttributeError: module 'networkx' has no attribute 'to_numpy_matrix'
To solve these issues, downgrade networkx or use nx.from_numpy_array() instead of nx.from_numpy_matrix(), and nx.to_numpy_array() instead of nx.to_numpy_matrix().
This package only handles digraphs without double edges, so it is recommended to use the remove_double_edges() function before performing computations. Also, it is not optimized; therefore, it is only efficient for small digraphs.
