Skip to content

NodeData

Kfir Goldfarb edited this page Jan 12, 2021 · 1 revision

NodeData class:

This class represents a node (vertex) in a graph. Each node has a key (node_id value), tag, scc_key and weight (use in graph algorithms class (GraphAlgo)), postion (tuple) and an info (string) (use like a metadata).

Class methods:

  1. def get_key() - return the node key (node_id).
  2. def get_pos() - return node position (as a tuple (x, y, z)), if the position of the node is None, create new position from get_position function from GraphCreator class.
  3. distance(another_node) - return the distance between this node and the other node (as a float).
  4. set_scc(scc_key) - set the scc_key to this node.
  5. def get_scc() - set new scc_key to this node.
  • the scc_key is used in strong connected components algorithm in GraphAlgo class.
Clone this wiki locally