graph_adversarial_attack
graph_adversarial_attack copied to clipboard
multiple edges modification
Hi, it seems the code only modifies one edge per graph. Is there a simpler way to change the code to multiple edges modification? I have not found a parameter in the code to control the edge budget. Thanks.
When you construct the environment you have the choice of maximum number of edges to modify:
https://github.com/Hanjun-Dai/graph_adversarial_attack/blob/master/code/graph_attack/rl_common.py#L35
Thank you for the reply.
I tried to modify the code to n_edges=2
or n_edges=3
here: https://github.com/Hanjun-Dai/graph_adversarial_attack/blob/f2aaad73efd142bcc20d5e8c43117e5359f9aa8e/code/graph_attack/dqn.py#L173
I also add one line time_t = time_t % 2
before this line: https://github.com/Hanjun-Dai/graph_adversarial_attack/blob/f2aaad73efd142bcc20d5e8c43117e5359f9aa8e/code/graph_attack/q_net.py#L172
When modifying 2 edges, the results are similar to modifying 1 edge. When modifying 3 edges, the acc drops to about 0.61 then rises to 0.9, even worse than modifying only one edge. It seems more code modification is needed?