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

pgr_maxCardinalityMatch problems #2341

Open
1 of 2 tasks
cvvergara opened this issue Jun 30, 2022 · 0 comments
Open
1 of 2 tasks

pgr_maxCardinalityMatch problems #2341

cvvergara opened this issue Jun 30, 2022 · 0 comments

Comments

@cvvergara
Copy link
Member

cvvergara commented Jun 30, 2022

Problems

Algorithm works for undirected graph only

From boost

Both edmonds_maximum_cardinality_matching and checked_edmonds_maximum_cardinality_matching find the maximum cardinality matching in any undirected graph.

I tried the example with directed graph.

$ g++ match_example.cpp 
$ ./a.out
a.out: match_example.cpp:74: int main(): Assertion `success' failed.
Aborted (core dumped)

No one else problems detected yet, but it should not be allowed to run on a directed graph. Eventually a problem will happen and the current results with directed graph are invalid for the problem definition.

About results

  • seq is not needed as the results unique identifier can be edge
  • And because the graph is undirected, source and target are also not needed.
    • Those are values that can be found by joining the result with the edges table on the database.

About the inner query

SELECT id, source, target, cost AS going, reverse_cost AS coming FROM edge_table

Following the general form on the inner query, it should be

SELECT id, source, target, cost, reverse_cost FROM edge_table

Changes

SQL

On V3

  • Create function pgr_maxCardinalityMatch(Edges SQL) -> returns edge
  • Deprecate function pgr_maxCardinalityMatch(Edges SQL, [directed]) -> returns (seq, edge, source, target)
    On V4
  • Remove function pgr_maxCardinalityMatch(Edges SQL, [directed])

code

On V3

  • Ignore the flag
  • Accept cost and reverse_cost as columns on the inner query
    On V4
  • Do not accept going & coming
  • Cleanup code

TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant