Node¶
- class Node[source]¶
Bases:
supervisely.io.json.JsonSerializable
Node for a single
GraphNodes
.- Parameters
- Usage example
import supervisely as sly from supervisely.geometry.graph import Node vertex = Node(sly.PointLocation(5, 5))
Methods
Convert a json dict to Node.
Convert the Node to a json dict.
- param transform_fn
function to convert location
Attributes
Display the Node when drawing or not.
Location of Node.
- classmethod from_json(data)[source]¶
Convert a json dict to Node. Read more about Supervisely format.
- to_json()[source]¶
Convert the Node to a json dict. Read more about Supervisely format.
- Returns
Json format as a dict
- Return type
- Usage example
import supervisely as sly from supervisely.geometry.graph import Node vertex = Node(sly.PointLocation(5, 5)) vertex_json = vertex.to_json() print(vertex_json) # Output: { # "loc": [5, 5] # }
- transform_location(transform_fn)[source]¶
- Parameters
- transform_fn
function to convert location
- Returns
Node class object with the changed location attribute using the given function
- property location¶
Location of Node.
- Returns
PointLocation object
- Return type