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

Issues in collect samples function #1

Open
AdritaBarua opened this issue Nov 2, 2022 · 5 comments
Open

Issues in collect samples function #1

AdritaBarua opened this issue Nov 2, 2022 · 5 comments

Comments

@AdritaBarua
Copy link

After the graph.pickle is generated, we should run the collect sample function to create the dataset for the next step, but we faced this issue mentioned in the screenshot.

Screen Shot 2022-11-02 at 4 24 41 PM

@ZhuKerui
Copy link
Collaborator

ZhuKerui commented Nov 4, 2022

@AdritaBarua By looking at the number shown in the status bar, I guess you are trying to generate samples where the target graph is undirected and the source graph is directed. This will bring up this problem since the "find_path_between_pair" tries to find a path starting from the "first_node" and ending in "second_node". When the target graph is undirected, there is no direction between the two nodes of an edge, and if the source graph is directed, the "second_node" may not be in the neighbors collected by graph.neighbors(first_node).

So to avoid this error, you may try target-source graphs as "directed-directed", "directed-undirected" or "undirected-undirected" instead of "undirected-directed". If you want to implement the "undirected-directed" collection, you may modify the following code

first_neighbors = set(graph.neighbors(first_node))
first_neighbors.remove(second_node)
second_neighbors = set(graph.neighbors(second_node) if not graph.is_directed() else graph.predecessors(second_node))
second_neighbors.remove(first_node)

into

first_neighbors = set(graph.neighbors(first_node))
if second_node in first_neighbors:
    first_neighbors.remove(second_node)
second_neighbors = set(graph.neighbors(second_node) if not graph.is_directed() else graph.predecessors(second_node))
if first_node in second_neighbors:
    second_neighbors.remove(first_node)

@AdritaBarua
Copy link
Author

Thanks for your response, we tried all the possibilities, and even with digraph-digraph, still we are getting the same error. and the previous run was for undirected-undirected. Could you please let us know where we have a problem, that we are getting this error?

@ZhuKerui
Copy link
Collaborator

@AdritaBarua To run for undirected-undirected, you may place the generated "graph.pickle" under the "extract_wiki" folder and then run python extract_wiki.py collect_sample false false 0.75. This command works on my computer.

@sanazskn
Copy link

@ZhuKerui We generated the "graph.pickle", but the error for running collect_sample as you can see in the screenshot is for the " Key error: Henry II, Duke of Bavaria"

@ZhuKerui
Copy link
Collaborator

@sanazskn Hi, could you please show me the complete error message and the command you use to run the script? Thanks.

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

No branches or pull requests

3 participants