graphrecords.indexers#

Indexers for GraphRecord nodes and edges.

Classes

EdgeIndexer(graphrecord)

Indexer for GraphRecord edges.

NodeIndexer(graphrecord)

Indexer for GraphRecord nodes.

class EdgeIndexer(graphrecord)[source]#

Bases: object

Indexer for GraphRecord edges.

__delitem__(key)[source]#

Deletes the specified edge attributes.

Parameters:

key (Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The edges from which to delete the attributes.

Raises:
  • ValueError – If the key is a slice, but not “:” is provided.

  • IndexError – If the query returned no results.

Return type:

None

__getitem__(key)[source]#

Gets the edge attributes for the specified key.

Parameters:

key (Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice, Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The edges to get attributes for.

Return type:

Union[GraphRecordValue, Attributes, Dict[EdgeIndex, Attributes], Dict[EdgeIndex, GraphRecordValue]]

Returns:

Union[GraphRecordValue, Attributes, Dict[EdgeIndex, Attributes], Dict[EdgeIndex, GraphRecordValue]] – The edge attributes to be extracted.

Raises:
  • ValueError – If the key is a slice, but not “:” is provided.

  • IndexError – If the query returned no results.

__setitem__(key, value)[source]#

Sets the edge attributes for the specified key.

Parameters:
  • key (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery, slice, Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The edges to which the attributes should be set.

  • value (Union[AttributesInput, GraphRecordValue]) – The values to set as attributes.

Raises:

ValueError – If there is a wrong value type or the key is a slice, but no “:” is provided.

Return type:

None

class NodeIndexer(graphrecord)[source]#

Bases: object

Indexer for GraphRecord nodes.

__delitem__(key)[source]#

Deletes the specified node attributes.

Parameters:

key (Tuple[Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The key to delete.

Raises:

ValueError – If the key is a slice, but not “:” is provided.

Return type:

None

__getitem__(key)[source]#

Gets the node attributes for the specified key.

Parameters:

key (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery, slice, Tuple[Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The nodes to get attributes for.

Return type:

Union[GraphRecordValue, Attributes, Dict[NodeIndex, Attributes], Dict[NodeIndex, GraphRecordValue]]

Returns:

Union[GraphRecordValue, Attributes, Dict[NodeIndex, Attributes], Dict[NodeIndex, GraphRecordValue]] – The node attributes to be extracted.

Raises:
  • ValueError – If the key is a slice, but not “:” is provided.

  • IndexError – If the query returned no results.

__setitem__(key, value)[source]#

Sets the specified node attributes.

Parameters:
  • key (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery, slice, Tuple[Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery, slice], Union[GraphRecordAttribute, GraphRecordAttributeInputList, slice]]) – The nodes to set attributes for.

  • value (Union[AttributesInput, GraphRecordValue]) – The values to set.

Raises:

ValueError – If there is a wrong value type or the key is a slice, but no “:” is provided.

Return type:

None