pylibwholegraph.torch.graph_structure.GraphStructure#

class pylibwholegraph.torch.graph_structure.GraphStructure#

Graph structure storage Actually, it is the graph structure of one relation, represented in CSR format. It contains CSR representation of Graph structure, and also attributes associated with nodes and edges.

Methods

multilayer_sample_without_replacement(...[, ...])

Multilayer sample without replacement :param node_ids: initial node ids :param max_neighbors: maximum neighbor for each layer :param weight_name: edge attribute name for weight, if None, use unweighted sample :return: target_gids, edge_indice, csr_row_ptr, csr_col_ind

set_csr_graph(csr_row_ptr, csr_col_ind)

Set the CSR graph structure :param csr_row_ptr: CSR graph row pointer :param csr_col_ind: CSR graph column index :return: None

set_edge_attribute(attr_name, attr_tensor)

Set attribute for edge :param attr_name: attribute name for edge :param attr_tensor: attribute tensor :return: None

set_node_attribute(attr_name, attr_tensor)

Set attribute for node :param attr_name: attribute name for node :param attr_tensor: attribute tensor :return: None

unweighted_sample_without_replacement_one_hop(...)

Unweighted Sample without replacement on CSR graph structure :param center_nodes_tensor: center node ids :param max_sample_count: max sample count for each center node :param random_seed: random seed for the sampler :param need_center_local_output: If True, output a tensor same length as sampled nodes but each element is the center node index in center_nodes_tensor. :param need_edge_output: If True, output the edge index of each sampled node :return: csr_row_ptr, sampled_nodes[, center_node_local_id, edge_index].

weighted_sample_without_replacement_one_hop(...)

Weighted Sample without replacement on CSR graph structure with edge weights attribute :param weight_name: edge attribute name for weight :param center_nodes_tensor: center node ids :param max_sample_count: max sample count for each center node :param random_seed: random seed for the sampler :param need_center_local_output: If True, output a tensor same length as sampled nodes but each element is the center node index in center_nodes_tensor. :param need_edge_output: If True, output the edge index of each sampled node :return: csr_row_ptr, sampled_nodes[, center_node_local_id, edge_index].

__init__()#

Methods

__init__()

multilayer_sample_without_replacement(...[, ...])

Multilayer sample without replacement :param node_ids: initial node ids :param max_neighbors: maximum neighbor for each layer :param weight_name: edge attribute name for weight, if None, use unweighted sample :return: target_gids, edge_indice, csr_row_ptr, csr_col_ind

set_csr_graph(csr_row_ptr, csr_col_ind)

Set the CSR graph structure :param csr_row_ptr: CSR graph row pointer :param csr_col_ind: CSR graph column index :return: None

set_edge_attribute(attr_name, attr_tensor)

Set attribute for edge :param attr_name: attribute name for edge :param attr_tensor: attribute tensor :return: None

set_node_attribute(attr_name, attr_tensor)

Set attribute for node :param attr_name: attribute name for node :param attr_tensor: attribute tensor :return: None

unweighted_sample_without_replacement_one_hop(...)

Unweighted Sample without replacement on CSR graph structure :param center_nodes_tensor: center node ids :param max_sample_count: max sample count for each center node :param random_seed: random seed for the sampler :param need_center_local_output: If True, output a tensor same length as sampled nodes but each element is the center node index in center_nodes_tensor. :param need_edge_output: If True, output the edge index of each sampled node :return: csr_row_ptr, sampled_nodes[, center_node_local_id, edge_index].

weighted_sample_without_replacement_one_hop(...)

Weighted Sample without replacement on CSR graph structure with edge weights attribute :param weight_name: edge attribute name for weight :param center_nodes_tensor: center node ids :param max_sample_count: max sample count for each center node :param random_seed: random seed for the sampler :param need_center_local_output: If True, output a tensor same length as sampled nodes but each element is the center node index in center_nodes_tensor. :param need_edge_output: If True, output the edge index of each sampled node :return: csr_row_ptr, sampled_nodes[, center_node_local_id, edge_index].