Skip to content

Conversation

@OnurEnginer
Copy link

Hello everyone,
This PR is my attempt in implementing the feature that is requested in issue #34. I would appreciate any suggestion on how to improve this implementation of Chinese Postman Problem Algorithm. Hopefully it can provide any meaningful contribution to GraphWalker.

Sincerely,
Onur Enginer

@nilols
Copy link
Member

nilols commented Jun 29, 2021

Awesome, I haven't looked at the PR yet but I'm very intrigued, I will have a look as soon as possible =)

int matrixSize = getMatrixSize();
int[][] costMatrix = new int[matrixSize][matrixSize];
VertexPair[][] pairMatrix = new VertexPair[matrixSize][matrixSize];
findUnbalanced();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what happens here in the findUnbalanced() method, it looks like we process things without saving or acting upon the result, I might also be tired =)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also see that "balance" the graph, if that would allow a path to be traversed several times, would be needed when we talk about traversing a model with the least amount of steps

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what happens here in the findUnbalanced() method, it looks like we process things without saving or acting upon the result, I might also be tired =)

This was meant to be where we first store negative and positive polarized vertices in their respective arrays neg[] and pos[], but I have realized that I should do that under polarize method, so I moved the operations there.

@nilols
Copy link
Member

nilols commented Jun 29, 2021

Could you add a unit test that show the algoritm in action?

@OnurEnginer
Copy link
Author

Could you add a unit test that show the algoritm in action?

I have added a success and a fail test case, let me know if there is anything else you want me to add.

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

Successfully merging this pull request may close these issues.

2 participants