dgld.models.SLGAD.dataset

This is dataset loading and processing program for SL-GAD

class dgld.models.SLGAD.dataset.SL_GAD_DataSet(base_dataset_name='Cora', subgraphsize=4, args=None, g_data=None, y_data=None)[source]

Bases: DGLDataset

This is a class to generate subgraph of dataset

Parameters
  • base_dataset_name (str, optional) – the name of dataset, defaulr Cora

  • subgraph_size (int, optional) – the size of subgraph, default 4

  • args (arg.parser, optional) – the extra parameter from arg.parser, default None

  • g_data (torch.Tensor) – graph of dataset made manually, default None

  • g_data – anomaly label of dataset made manually, default None

adj_matrix()[source]

functions to store adjacency matrix

construct_graph(pace)[source]

Functions that construct the ith subgraph

Parameters

pace (list) – random walk, the set of node to construct graph

Returns

temp_graph – the subgraph

Return type

DGL.Graph

graph_transform(g)[source]

functions to transfrom graph

Parameters

g (DGL.Graph) – the graph to transform

Returns

newg – the graph after transform

Return type

DGL.Graph

normalize_adj()[source]

functions to normalize the edge weight in graph

normalize_feat()[source]

functions to normalize the features of nodes in graph

process()[source]

nonsense

random_walk_sampling()[source]

functions to get random walk from target nodes

write_graph()[source]

write graph into graph.txt

dgld.models.SLGAD.dataset.safe_add_self_loop(g)[source]

Add the self loop in g :param g: the graph to add self loop :type g: DGL.graph

Returns

newg – the graph has been added self loop

Return type

DGL.Graph