netdecom Documentation
Overview
netdecom is a Python package for advanced graph analysis, providing algorithms for minimal collapsible set extraction and recursive decomposition for both undirected graphs (UGs) and directed acyclic graphs (DAGs). It combines a compiled core extension with igraph and networkx utilities.
Installation
>>> pip install netdecom
Core Functionalities
1. Minimal collapsible set Identification in Undirected Graphs
Finds the minimal collapsible set containing a given node set R:
>>> import netdecom as nd
>>> import igraph as ig
>>> G = ig.Graph([(0, 1), (1, 2), (2, 3)])
>>> nd.get_minimal_collapsible(G, [1, 3])
2. Atom Decomposition
Decomposes graphs into atoms using MCS ordering:
>>> nd.decompose_atoms(G)
3. Minimal collapsible set Identification in Directed Acyclic Graphs
Finds the minimal collapsible set containing a given node set R:
>>> import igraph as ig
>>> G = ig.Graph([(0, 1), (1, 2), (2, 3)], directed=True)
>>> nd.dag_get_minimal_collapsible(G, [1, 3]) # Close Minimal D-Separator Absorbing Algorithm
>>> nd.dag_get_ancestors(G, [1, 3])
4. Random Graph Generation
>>> ug = nd.generator_connected_ug(n,p,class_type="ig") # generates a random connected graph with n nodes and edge probability p; returns an igraph graph by default or a NetworkX graph if class_type="nx".
>>> dag = nd.generate_connected_dag(n, p, max_parents=3) # Generate a connected Directed Acyclic Graph (DAG) with n nodes, edge probability p, and maximum 3 parents per node.
>>> dag = nd.random_connected_dag(n, p) # Generate a random Directed Acyclic Graph (DAG) with n nodes and edge probability p.
5. Load Example Graphs
get_example(file_name, class_type="ig")
Reads the specified example file from the library and returns the corresponding undirected graph object (either NetworkX or igraph):
Parameters:
file_name(str): The name of the example file to be read. The following example files are available:class_type(str): Graph backend type. Use"ig"forigraph.Graph(default) or"nx"fornetworkx.Graph.
| File Name | Nodes | Edges | Connected Components | Largest Component Size |
|---|---|---|---|---|
| Animal-Network.txt | 445 | 1332 | 22 | 117 |
| bio-CE-GT.txt | 924 | 3239 | 13 | 878 |
| as20000102.txt | 6474 | 12572 | 1 | 6474 |
| DD6.txt | 4152 | 10320 | 1 | 4152 |
| CA-HepTh.txt | 9875 | 25973 | 427 | 8638 |
| com-youtube.ungraph.txt | 1134890 | 2987624 | 1 | 1134890 |
Returns:
- Returns
igraph.Graphwhenclass_type="ig"(default), ornetworkx.Graphwhenclass_type="nx".
Example:
>>> G = nd.get_example("Animal-Network.txt", class_type="nx") # Reads the example file and returns a NetworkX graph.
>>> G = nd.get_example("Animal-Network.txt", class_type="ig") # Reads the example file and returns an igraph graph.
Notes
get_minimal_collapsible,decompose_atoms,dag_get_minimal_collapsible, anddag_get_ancestorsare provided by the compiled extension module (netdecom.decom_h) and are intended to work with igraph graph objects.generator_connected_ugcan return eitherigraph.Graphornetworkx.Graphbased onclass_type.generate_connected_dagandrandom_connected_dagreturnnetworkx.DiGraphobjects.
Metadata
Release files for netdecom 0.0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netdecom-0.0.5.6.tar.gz | 19.7 MB | Without provenance | Details for netdecom-0.0.5.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netdecom-0.0.5.6-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details for netdecom-0.0.5.6-cp39-cp39-win_amd64.whl |
Total release size: 39.6 MB
Release files / netdecom-0.0.5.6.tar.gz
| Download URL | netdecom-0.0.5.6.tar.gz |
|---|---|
| Size | 19.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
315ed6036b96425178cbbf127eef1cddf7283b05208a047783b5cab90f010f14
|
|
BLAKE2b-256 checksum How to use checksums |
466051baa0b844554bcbf68830f9ab97c6cc990e8a0c6469120b49f18dad146f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.12
|
Release files / netdecom-0.0.5.6-cp39-cp39-win_amd64.whl
| Download URL | netdecom-0.0.5.6-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 19.9 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7eb86693b560fccd480fdd4f1bf8454371489f2c0910a1e1e0ec898113673333
|
|
BLAKE2b-256 checksum How to use checksums |
63efb66894e324109a802dfa369f6558ce5e8d868b8cc8df8050aca7aa760241
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.12
|
Security for netdecom 0.0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.