Node

cluster.graph provides interfaces for Graph, Node and Edge.

class Node(value: Any, attributes: Optional[Dict[AnyStr, Any]] = None)

Node of a graph

Parameters
  • value – the value of the node

  • attributes – attributes of the node

get_attribute(attribute: AnyStr)Any

get one specific attribute by name

Parameters

attribute – the attribute’s name

Returns

the attribute requested

Return type

Any

get_attributes()Dict[AnyStr, Any]

get the attributes of the node

Returns

attributes of the node

Return type

Any

get_degree()int

get the degree of the node

Returns

degree of node

Return type

int

get_value()Any

get the value of the node

Returns

value of the node

Return type

Any

increase_degree(by: int)None

increase the degree of the node

Parameters

by – increment the node’s degree is increased by

Returns

None

set_attribute(attribute: AnyStr, value: Any)None

set one specific attribute by name

Parameters
  • attribute – the attribute to be set

  • value – the value the attribute is set to

Returns

None

set_degree(degree: int)None

set the degree of the node

Parameters

degree – degree of the node

Returns

None