Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:46:29+00:00 2026-06-04T23:46:29+00:00

I wanted an algorithm to eliminate the sides of a cyclic directed graph or

  • 0

I wanted an algorithm to eliminate the sides of a cyclic directed graph or mostly a Tournament and output a tree kind of structure with minimum number of sides.

The elimination should be based on the weight of the sides, as described below in as a simple real world example.

If there are three friends A,B,C. Take a scenario of borrowing & returning money between each other.

Person A has to transfer Person B – $10.
Person B has to transfer Person C – $20.
Person C has to transfer Person A – $20.

In the final settlement to minimize the number of transfers between each other we can rearrange the above to something like “Person B will transfer Person A – $10” and everything is settled.

I am looking for some algorithm which will work for any number of nodes when weight of each side and direction is given.

Given that the graph can be rearranged and chances are high that the graph might be a “Tournament” where each node is connected to all the nodes in the graph, what would be the best approach I follow.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:46:32+00:00Added an answer on June 4, 2026 at 11:46 pm

    n – 1 edges is pretty easy to obtain. First compute everyone’s “net worth”, put the borrowers in one list, put the lenders in another, and then repeatedly make a transfer from the borrower at the front of the line to the lender, removing one or both if they are saturated (returned to zero).

    The preceding algorithm is a 2-approximation. Minimizing the number of transfers means maximizing the number of doubly-saturating transfers, which is a knapsack-like problem that’s at least weakly NP-hard. There’s an exponential-time dynamic program that might be suitable for small n (naive is more like n^n).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have generated a minimum spanning tree using Kruskal's algorithm and I wanted to
The following is pseudo code for Kruskal's Minimum Spanning Tree algorithm from our CS
I'm working on data structure for graph cut algorithm. Problem is to make different
I'm kind of new to algorithms and wanted to implement heap sort algorithm. The
I try to break down the decoding algorithm wanted question into smaller questions. This
I wanted to make my own encryption algorithm and decryption algorithm , encryption algorithm
I'm currently implementing a poor-man's version of the RSA Algorithm and I wanted the
I recently wanted to use boost::algorithm::join but I couldn't find any usage examples and
H community, I wanted to ask if there is an algorithm for choosing the
Before I plan to apply some algorithm, wanted to clarify, whether easier solution is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.