Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug of weighted graph #3

Closed
zl930216 opened this issue Jun 14, 2019 · 1 comment
Closed

bug of weighted graph #3

zl930216 opened this issue Jun 14, 2019 · 1 comment

Comments

@zl930216
Copy link

in WeightedGraph.mwis, max_weight is initialized min(self.__weights.values()), that would cause problem when all branches have the same score or there is only one branch. In that situation, no branch will be picked as solution. Setting it min(self.__weights.values())-1 or any value smaller than that will solve it.

@jonperdomo
Copy link
Owner

@zl930216 You must be referring to the following:

# Find the maximum weighted set
max_weight = min(self.__weights.values())
mwis = []
for ind_set in ind_sets:
set_weight = sum([self.__weights[str(i)] for i in ind_set])
if set_weight > max_weight:
max_weight = set_weight
mwis = ind_set
return mwis

This loop determines the maximum weighted independent set from all nodes in the graph, which will represent the non-conflicting set of branches with the highest likelihoods / weights. I am using the minimum node weight min(self.__weights.values()) as my initial maximum set weight. There are many cases where the sum weight of the set will be less than the lowest node weight, considering that weights can be negative. Thank you, and I will push an update correcting this.

jonperdomo added a commit that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants