Node¶
- class Node[source]¶
Bases:
supervisely.io.json.JsonSerializableNode for a single
GraphNodes.- Parameters
- location : PointLocation
PointLocation object.
- disabled : bool, optional
Determines whether to display the Node when drawing or not.
- label :
Optional[str] str
- row :
Optional[int] int
- col :
Optional[int] int
- 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.
- Parameters
- data : dict
Node in json format as a dict.
- Returns
Node object
- Return type
- Usage example
vertex_json = { "loc": [5, 5] } vertex = Node.from_json(vertex_json)
- to_json()[source]¶
Convert the Node to a json dict. Read more about Supervisely format.
- Returns
Json format as a dict
- Return type
dict- 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 disabled¶
Display the Node when drawing or not.
- Returns
Boolean
- Return type
bool
- property location¶
Location of Node.
- Returns
PointLocation object
- Return type