Model.nodemarkbypath#

Model.nodemarkbypath(node_entity1, node_entity2, collection)#

Creates a node path from the starting node to the ending node. If both node_entity1 and node_entity2 lie on free edges, the path will follow free edges where possible. Otherwise, the shortest path is returned.

Parameters:
  • node_entity1 (Entity) – The object describing the first node entity.

  • node_entity2 (Entity) – The object describing the second node entity.

  • collection (Collection) – The collection containing the node entities to populate.

Example#

Determine the path between the nodes with IDs 100 and 110#
import hm
import hm.entities as ent

model = hm.Model()

outcollection=hm.Collection(model, ent.Node, populate=False)

model.nodemarkbypath(
    node_entity1=ent.Node(model, 100),
    node_entity2=ent.Node(model, 110),
    collection=outcollection,
)