MCPcopy Create free account
hub / github.com/GATECH-EIC/GCoD / plot_raw_adj

Function plot_raw_adj

plot_adj.py:42–55  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

40 ax.plot([y, y], [x, z], c=color, lw=5, alpha=0.6)
41
42def plot_raw_adj(data):
43 edge_attr = torch.ones(data.edge_index[0].size(0))
44 eye = torch.eye(data.x.size(0)).to_sparse().to(device)
45 oriadj = SparseTensor(row=data.edge_index[0], col=data.edge_index[1], value=torch.clone(edge_attr)).to_torch_sparse_coo_tensor()
46 oriadj = SparseTensor.from_torch_sparse_coo_tensor(oriadj + eye)
47 row, col, value = oriadj.coo()
48 adj_size = data.x.size(0)
49
50 ax[0].scatter(row, col, s=10, alpha=0.5, c='b')
51 ax[0].set_ylim([0, adj_size])
52 ax[0].set_xlim([adj_size, 0])
53 ax[0].set_xticks([])
54 ax[0].set_yticks([])
55 ax[0].set_title('Before optimization', fontsize=font_big, fontweight="bold", y=1.02)
56
57
58def plot_optimzed_adj(checkpoint, bd, n_class, n_groups):

Callers 1

plot_adj.pyFile · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected