No project description provided
Project description
Small Feedback Arc Set (sfas)
Efficient implementation of a greedy algorithm for computing small feedback arc sets in directed weighted multi-graphs. This implementation is an adaptation of the algorithm described in Section 2.3 of this article, with additional generalization to support weights and parallel edges.
Description
Given a weighted directed graph, computes a topological sorting (linear order of the nodes) that minimizes (greedily) the number of backward edges - feedback arc set. In particular, removing the set of edges going backward in the resulting order breaks all directed cycles in the graph.
Install
pip install sfas
Example usage
graph = [
['a', 'b', 1],
['a', 'c', 1],
['c', 'd', 2],
['d', 'a', 2],
]
from sfas import greedy
ouput = greedy.compute_order(graph)
output
['c', 'd', 'a', 'b']
Interface
Params:
connections : List[List[Any, Any, Int]]- list of edges, each represented as a 3-item list consisting of[<from node>, <to node>, <edge weight>]verbosity : Int- prints progress and other stats for values > 0random_seed : Intrandomness is in picking the next "greedy" step among equally qualified ones
Result:
Listwith all nodes, ordered so that the total weight of edges going backwards (w.r.t. this order) is small
Questions / suggestions welcome
arie.matsliah@gmail.com
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 sfas-1.0.0.tar.gz.
File metadata
- Download URL: sfas-1.0.0.tar.gz
- Upload date:
- Size: 118.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1177da11fd43a74151c5c1b59da1807f326d84066dbdcce07dba82dcaa07b51f
|
|
| MD5 |
a06171160f8f48ce0cc769300860cf3f
|
|
| BLAKE2b-256 |
e680f14c945960518c45081c67cd3a28541e1a9a63baeefd63d61770865f532a
|
File details
Details for the file sfas-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sfas-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f4878f6b71fcd1f031345d2bd5eb5b05e44c59e8e2bc0e2c69d2dbc185b94f5
|
|
| MD5 |
aede4e20ac82af0f9df4cffe8742d8fc
|
|
| BLAKE2b-256 |
61edb55062ca4b105b184c379b5036e1d61ff9854ac9a94d91c08e2a8a1fadb3
|