pgr_maxCardinalityMatch problems

オープン
#2,341 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
cpp, postgresql
領域
backend, databases

調査の方向性

The issue is about the pgr_maxCardinalityMatch function in pgRouting. The algorithm currently incorrectly accepts directed graphs, but should only work on undirected graphs. Check the function implementation in the C++ code, likely in files related to matching algorithms. The changes involve modifying the SQL signature and internal handling of cost/reverse_cost columns. Review the linked pull requests #2342 and #2343 for context on what has been done. Testing involves running the matching example and ensuring directed graphs are rejected.

索引モデルが issue の本文から書いたものです。

説明

Bug Report Flow

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

  • #2342
  • #2343
主要言語
C++
スター
1.4k
フォーク
397
平均マージ
2日 2時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pgRouting/pgrouting のほかの issue

pgRouting/pgrouting の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。