https://github.com/oeljeklaus-you/mgtag
MGTag是一个解决图可达性NP问题(主要是图内可达性问题)的程序,采用层次划分、图内Interval和上下索引等思想解决NP难题
https://github.com/oeljeklaus-you/mgtag
c-plus-plus graph
Last synced: 8 months ago
JSON representation
MGTag是一个解决图可达性NP问题(主要是图内可达性问题)的程序,采用层次划分、图内Interval和上下索引等思想解决NP难题
- Host: GitHub
- URL: https://github.com/oeljeklaus-you/mgtag
- Owner: oeljeklaus-you
- Created: 2018-04-24T08:17:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-24T08:31:29.000Z (over 7 years ago)
- Last Synced: 2025-03-21T08:51:19.320Z (8 months ago)
- Topics: c-plus-plus, graph
- Language: C++
- Homepage:
- Size: 529 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MGTag
Compile
g++ main.cpp -O3 -std=c++11 -o mgtag
Run
./mgtag {graph} {query}
Graph File Format
The first line must be "graph_for_greach".
The second line contains V, the number of vertices of the graph.
Then V lines follow.
Each line describes edges from a certain vertex, u, to its successors, v_i, in the following format.
u: v_1 v_2 ... v_deg+(u)#
Query File Format
Each line contains a query, Reach(u, v), in the following format.
u v result
If result is 0, then Reach(u, v) should be false;
if result is 1, then Reach(u, v) should be true;
otherwise result should be -1, which means the result it unknown.
Please note vertices are numbered from 0 to V - 1, and the graph must be a DAG.