πΎ<Path> Object Doc.
A Path
object encapsulates a sequence of nodes and edges, representing a route through a graph structure. They're returned by the Graph Search Algorithms.
Constructor:
__init__(self, nodes, edges)
: Initializes a newPath
instance.nodes
: A tuple of node instances (NodeSet
), delineating the sequential nodes in the path. This includes the START and the END elements.edges
: A tuple representing the edges that connect the nodes in the path.
>> path.nodes
NodeSet(size=5)
>> path.edges
['synset0', 'semset1', ...]
Methods:
__repr__(self)
: Returns a string representation of thePath
, showing the number of edges.
# Representing a Path instance
print(path) # Output: <Path(length=1)>
Last updated