DSE-MSU / DeepRobust

A pytorch adversarial library for attack and defense methods on images and graphs
MIT License
994 stars 192 forks source link

Topology Attack also considers main diagonal (twice) #46

Closed sigeisler closed 3 years ago

sigeisler commented 3 years ago

Hi,

I fear there is an issue with the topology attack. From what I understand you initialize as many elements in self.adj_changes as the upper half of the adjacency matrix without the main diagonal. I agree that this is correct. However, in get_modified_adj(...) you get the indices including the main diagonal but exclude the node with the highest index. I believe tril_indices = torch.tril_indices(row=self.n, col=self.n, offset=-1) should fix it.

ChandlerBang commented 3 years ago

Thank you so much! That is a very crucial point!

I've just fixed it.