Attribute

class gli.io.Attribute(name, data, description='', data_type=None, data_format=None)

Bases: object

An attribute of a node, an edge, or a graph.

__init__(name, data, description='', data_type=None, data_format=None)

Initialize the attribute.

Parameters:
  • name (str) – The name of the attribute.

  • data (array-like) – The data of the attribute.

  • description (str, optional) – The description of the attribute, defaults to “”.

  • data_type (str, optional) – The type of the data, which must be one of “int”, “float”, or “str”. If not specified, the type will be automatically detected, defaults to None.

  • data_format (str, optional) – The format of the data, which must be one of “Tensor” or “SparseTensor”. If not specified, the format will be automatically detected, defaults to None.

Raises:

TypeError – If the input data is not a scipy sparse array or numpy array.

get_metadata_dict()

Return the metadata dictionary of the attribute.