Skip to main content

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, calculates linear arrangement 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.

Interface

Input:

  1. connections: list of edges, each represented as a 3-item list consisting of [, , ]
  2. verbosity: prints progress and other stats for values >0
  3. random_seed: randomness is in picking the next "greedy" step among equally qualified ones

Output:

  1. list with all nodes, ordered so that the total weight of edges going backwards (w.r.t. this order) is small

Install

pip install sfas

Example usage

from sfas import greedy
graph = [
    ['a', 'b', 1],
    ['b', 'c', 1],
    ['c', 'a', 2],
]
greedy.compute_order(graph, verbosity=0, random_seed=0)

output

['c', 'a', 'b']

Questions / suggestions welcome

arie.matsliah@gmail.com

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

sfas-0.0.6.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sfas-0.0.6-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file sfas-0.0.6.tar.gz.

File metadata

  • Download URL: sfas-0.0.6.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for sfas-0.0.6.tar.gz
Algorithm Hash digest
SHA256 26656860755a80395577d14b3fbe4beb3a307c8320455e0eb4f140bbd738af15
MD5 64d979113943a373db4c979de5daaad0
BLAKE2b-256 232a7309ba608feb2ef986d13c43c7af08008aec68e8558b62e3d60c26d3e769

See more details on using hashes here.

File details

Details for the file sfas-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: sfas-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for sfas-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eeebce8edf731f1de2e0845cbfa26679df702799703e5f6304675832d4cad49b
MD5 f381c9ad962366c7220e84601aa37ff2
BLAKE2b-256 e03dff79a397eda35e9a8723a9971f66e9aaed89542a059f83fe4eb63b05655e

See more details on using hashes here.

Supported by

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