Model.nodelistbypath2#

Model.nodelistbypath2(nodeA, nodeB, entitylist, ignoreEdgeFlag, search_factor=1)#

Creates a node path from the starting node to the ending node.

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

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

  • entitylist (EntityList) – A list containing the node entity objects to populate.

  • ignoreEdgeFlag (int) –

    0 - If both nodeA and nodeB lie on free edges, the path will follow free edges where possible. Otherwise, the shortest path is returned. This is the same as running nodelistbypath().

    1 - Always return the shortest path.

  • search_factor (double) – By default, only a subsection of the model is considered when creating the node path. Increasing this value will increase the search area. Default value is 1.0.

Examples#

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

model = hm.Model()

entitylist = hm.EntityList(ent.Node, hm.hwUIntList([]))

model.nodelistbypath2(
    nodeA=ent.node(model, 100),
    nodeB=ent.Node(model, 110),
    entitylist=list,
    ignoreEdgeFlag=1,
)
Determine the path between nodes with IDs 100 and 110 use the shortest path consider the increase in search area by 20 percent#
import hm
import hm.entities as ent

model = hm.Model()

entitylist = hm.EntityList(ent.Node, hm.hwUIntList([]))

model.nodelistbypath2(
    nodeA=ent.node(model, 100),
    nodeB=ent.Node(model, 110),
    entitylist=list,
    ignoreEdgeFlag=1,
    search_factor=1.2,
)