Skip to main content

Priority Based Connected Components

Project description

Priority Based Connected Components

It takes an integer as an input and prints it square.

Installation

pip install priorityY

How to use it?

from priorityY import *
G = [(1,4,1),(1,5,3),(2,3,2),(2,6,2),(6,7,3),(4,8,2),(5,9,1)]
threshold = 3
components = priority_based_linkage(G,threshold)
print(components)

Output

[[1, 4, 8], [2, 3, 6], [5, 9], [7]]

Let us visualise the above example for better understanding how the library works. The threshold is set to 3, limiting the size of components. Dotted edges denote the link and priority associated.

At the first iteration, all nodes having edges with Priority-1 get connected.

1–4 and 5–9 gets connected.

In the next iteration, the algorithm connects nodes with edges between them of Priority-2.

1–4–8 gets connected, 2–3–6 gets connected and both reach the threshold

The algorithm stops as the threshold is reached for components and no more edges left. Above are the final connected components with the set threshold and provided edges priority.

License

© 2021 Abhishek Mungoli, Pravesh Garg, Somedip Karmakar

This repository is licensed under the MIT license. See LICENSE for details.

Change Log

0.0.1 (23/08/2021)

  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

priorityY-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file priorityY-0.0.1.tar.gz.

File metadata

  • Download URL: priorityY-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.4

File hashes

Hashes for priorityY-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ceb6908a9a08a6d5afea56f4fd756603a22a7bab381a84dc61e936de7260043a
MD5 747d479eda9588b2f96828de0fb63dc1
BLAKE2b-256 8bbf86d1b37d51630210865a3335dc40ffffb414d64c372445b3822cf065b20a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page