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

CS224W ReaRev GNN-RAG #9857

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d6c115a
Create rearev_data_loader.py
natalieshell22 Dec 13, 2024
f216279
Create rearev_data_loader_test.py
natalieshell22 Dec 13, 2024
7188791
Create rearev.py
natalieshell22 Dec 13, 2024
92a097d
Create trainer_kbqa.py
natalieshell22 Dec 13, 2024
218abf2
Create graph_utils.py
natalieshell22 Dec 13, 2024
6f7676e
Create reason.py
natalieshell22 Dec 13, 2024
019dd36
Update CHANGELOG.md
natalieshell22 Dec 13, 2024
03508a0
Update rearev_data_loader_test.py
natalieshell22 Dec 13, 2024
04fe125
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
7edb8ac
Update rearev_data_loader.py
natalieshell22 Dec 13, 2024
a126372
Update trainer_kbqa.py
natalieshell22 Dec 13, 2024
0c30f2e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
c788edb
Update rearev.py
natalieshell22 Dec 13, 2024
e411b63
Update reason.py
natalieshell22 Dec 13, 2024
21e3139
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
f59bc67
Update graph_utils.py
natalieshell22 Dec 13, 2024
c7fc6cc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
397291f
Update trainer_kbqa.py
natalieshell22 Dec 13, 2024
291d461
Update rearev.py
natalieshell22 Dec 13, 2024
8ed7c76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
90961e0
Update graph_utils.py
natalieshell22 Dec 13, 2024
f06cab1
Update reason.py
natalieshell22 Dec 13, 2024
e85f635
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
5a090cd
Update trainer_kbqa.py
natalieshell22 Dec 13, 2024
70db241
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
834565a
Update trainer_kbqa.py
natalieshell22 Dec 13, 2024
0a0ace9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
119fd07
Update reason.py
natalieshell22 Dec 13, 2024
7f4e99a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
5f24243
Update graph_utils.py
natalieshell22 Dec 13, 2024
280fae9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
9f49b2f
Update rearev.py
natalieshell22 Dec 13, 2024
fbec144
Update graph_utils.py
natalieshell22 Dec 13, 2024
5952480
Update reason.py
natalieshell22 Dec 13, 2024
17295ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
33c9758
Update graph_utils.py
natalieshell22 Dec 13, 2024
3f43890
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
3a78d97
Update reason.py
natalieshell22 Dec 13, 2024
8485eaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
320f77e
Update graph_utils.py
natalieshell22 Dec 13, 2024
5ce693e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update graph_utils.py
  • Loading branch information
natalieshell22 authored Dec 13, 2024
commit f59bc67b28da247908e1171ccda8c534fd6c7f0c
9 changes: 6 additions & 3 deletions torch_geometric/utils/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
def build_pyg_graph(graph_data: List[Tuple[str, str, str]],
entities: Optional[List[str]] = None,
encrypt: bool = False) -> Data:
"""Construct a PyG Data object from a list of (head, relation, tail) triplets.
"""Construct a PyG Data object from a list of (head, relation,
tail) triplets.
"""
edges = []
for h, r, t in graph_data:
Expand Down Expand Up @@ -90,7 +91,8 @@ def pyg_data_to_networkx(data: Data) -> nx.Graph:
def bfs_with_rule(data: Data, start_node: Union[str,
int], target_rule: List[str],
max_p: int = 10) -> List[List[Tuple[str, str, str]]]:
"""Perform BFS to find paths matching a sequence of relations (target_rule).
"""Perform BFS to find paths matching a sequence of relations
(target_rule).
"""
G = pyg_data_to_networkx(data)

Expand Down Expand Up @@ -123,7 +125,8 @@ def bfs_with_rule(data: Data, start_node: Union[str,

def get_truth_paths(q_entities: List[str], a_entities: List[str],
data: Data) -> List[List[Tuple[str, str, str]]]:
"""Retrieves all shortest paths between question entities and answer entities.
"""Retrieves all shortest paths between question entities
and answer entities.
"""
G = pyg_data_to_networkx(data)
paths = []
Expand Down
Loading