solve edge combination of group graph
Project description
group_diagram_combination
Select several edges from a set of grouped nodes to form a grouped graph (e.g., bipartite graph, tripartite graph).
Install
pip install group-diagram-combination
Usage
from group_diagram_combination import main
print(main([2, 3, 4], 2))
Problem Description
There are $K$ groups of nodes, where the $i$-th group contains $a_i$ distinct nodes (all nodes are unique). We need to connect exactly $M$ undirected edges in the graph such that:
- Nodes within the same group cannot be connected to each other
- The same edge cannot be selected twice
Calculate all valid solutions that satisfy the above constraints.
Problem Input
Given a sequence $a_i$ of length $K$, and $M$.
Problem Output
Output all valid solutions.
Input Example
[[2, 2], 2]
Output Example
[
[[[1, 1], [2, 1]], [[1, 1], [2, 2]]],
[[[1, 1], [2, 1]], [[1, 2], [2, 1]]],
[[[1, 1], [2, 1]], [[1, 2], [2, 2]]],
[[[1, 1], [2, 2]], [[1, 2], [2, 1]]],
[[[1, 1], [2, 2]], [[1, 2], [2, 2]]],
[[[1, 2], [2, 1]], [[1, 2], [2, 2]]],
]
Note: [i, j] denotes the $j$-th node in the $i$-th group. [[x, y], [p, q]] denotes an undirected edge between the $y$-th node in the $x$-th group and the $q$-th node in the $p$-th group. Both group numbers and node numbers start from 1.
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 group_diagram_combination-0.0.2.tar.gz.
File metadata
- Download URL: group_diagram_combination-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.13.12 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d63dd056298018244211d9733e7b593e32e584c26bcac84601e0a3ab9bd0462
|
|
| MD5 |
ba8eabde04566f61ed34ab514e609ddb
|
|
| BLAKE2b-256 |
965ad261e55fbd841d8dd0b15dd8a6e9eb1b1d8572e0cf52a8bf1ed21b8f9a6c
|
File details
Details for the file group_diagram_combination-0.0.2-py3-none-any.whl.
File metadata
- Download URL: group_diagram_combination-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.13.12 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a40fc0dbfb6e0e9b10666ef17d55cdd5246245c65b5b84770a32374636a1894e
|
|
| MD5 |
3ecb759dd0e3ba0a715ea483c599d9c1
|
|
| BLAKE2b-256 |
20d06d02f0d56d80459c760e22dfd58b259074e537883d48fcfea489b9cb201f
|