Dimensionality Reduction and Decomposition of Undirected Graph Models and Bayesian Networks
Project description
NetDecom Documentation
Overview
NetDecom is a Python package for advanced graph analysis, providing algorithms for convex subgraph extraction and recursive decomposition of both undirected graphs (UGs) and directed acyclic graphs (DAGs). Built on NetworkX, it offers efficient implementations of three core functionalities.
Installation
>>> pip install NetDecom
Core Functionalities
1. Convex Hull Identification in Undirected Graphs
Finds the minimal convex subgraph containing a given node set R:
>>> import NetDecom as nd
>>> import networkx as nx
>>> G = nx.Graph([(1, 2), (2, 3), (3, 4)])
>>> nd.IPA(G, [1, 3]) # Inducing Path Absorbing Algorithm
>>> nd.CMSA(G, [1, 3]) # Close Minimal Separator Absorbing Algorithm
2. Recursive Graph Decomposition
Decomposes graphs into maximal prime subgraphs using MCS ordering:
>>> MCS = [1, 2, 3, 4] # Maximum Clique Sequence
>>> nd.Decom_CMSA((G, MCS)) # CMSA-based decomposition
>>> nd.Decom_IPA((G, MCS)) # IPA-based decomposition
3. Directed Convex Hull Identification in Directed Acyclic Graphs
Finds the minimal d-convex subgraph containing a given node set R:
>>> G = nx.DiGraph([(1, 2), (2, 3), (3, 4)])
>>> nd.CMDSA(G, [1, 3]) # Close Minimal D-Separator Absorbing Algorithm
4. Random Graph Generation
Generates random connected graphs, including UGs and DAGs, with specified parameters for node count and edge probability.
generator_connected_ug(n, p)
generate_connected_dag(n, p, max_parents=3)
Parameters:
n(int): The number of nodes in the graph.p(float): The probability of adding an edge between any pair of nodes (for UG) or from a parent node to a child node (for DAG). The value should be between 0 and 1.max_parents(int, optional): The maximum number of parent nodes for each node in the DAG. Defaults to 3.
Returns:
- A connected graph (
networkx.Graphfor UG ornetworkx.DiGraphfor DAG).
Example:
>>> ug = nd.generator_connected_ug(10, 0.3) # Generate a connected UG with 10 nodes and edge probability 0.3
>>> dag = nd.generate_connected_dag(10, 0.3, max_parents=3) # Generate a connected DAG with 10 nodes, edge probability 0.3, and maximum parents 3
5. Load Example Graphs
get_example(file_name)
Reads the specified example file from the library and returns the corresponding undirected NetworkX graph object.
Parameters:
file_name(str): The name of the example file to be read. The following example files are available:Animal-Network.txtas20000102.txtbio-CE-GN.txtbio-CE-GT.txtbio-DR-CX.txtCA-CondMat.txtCA-HepTh.txtDD6.txtEmail-Enron.txtmammalia-voles-rob-trapping-22.txtrec-amazon.txtrec-eachmovie.txtrec-movielens-tag-movies-10m.txtrec-movielens-user-movies-10m.txtrec-movielens.txtrec-yelp-user-business.txt
Returns:
- A NetworkX UG object corresponding to the specified example file.
Example:
>>> G = nd.get_example("Email-Enron.txt") # Load the Enron email network as an UG
## Notes
- All input graphs must be NetworkX Graph/DiGraph objects.
- MCS ordering should follow graph topology.
- DAG decomposition features are under development.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file NetDecom-0.0.4.9.tar.gz.
File metadata
- Download URL: NetDecom-0.0.4.9.tar.gz
- Upload date:
- Size: 38.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6c3506e1bed4bd5097ddb94c2b34d273c4841ecd0fffeb6655f30e8ddca0523
|
|
| MD5 |
4eaa82974b1935c1e3f2f2da46e98079
|
|
| BLAKE2b-256 |
0de859f9f0faf4fbc6e4047aa110f922fed5f8e29b984319b8240c5aae0ae8e0
|
File details
Details for the file NetDecom-0.0.4.9-py3-none-any.whl.
File metadata
- Download URL: NetDecom-0.0.4.9-py3-none-any.whl
- Upload date:
- Size: 39.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
262f64f3745b17e35c424842347630a7baa0149b193cfc9895e181208b0cb5f5
|
|
| MD5 |
dd39b3b749e193ed23732f137045d7e5
|
|
| BLAKE2b-256 |
328751cd6a2dbd917ddc446ece11a117c01eb6a54c4e3bd5e5961d2ed83c1c9b
|