Offset, Distance, and Walk over Half-Edge Mesh
Presented here are three functions for working with Half-Edge Meshes in Grasshopper.
The first uses the lists of vertex’ incident edges (vIE) to calculate the bisecting angles at intersections in-between branches and create an offset of the graph which can be uniquely defined at every vertex (in black and grey in the image above). The output creates two sets of polylines: one which defines the faces and one which defines a polygon around the intersection (in the case of two-segment intersections, this is a straight, bisecting line segment). This is useful for giving a graph material thickness or for offsetting faces inward to suggest circulation capacity along the edges.
The second function analyses the distance of every edge to a point at one of the nodes over the graph (red-yellow-blue gradient in the image above). That is, the distance it would take to walk from one of the origin points to the midpoint of that edge taking shortest path from node to node along edges only. This can be used to take into account the embedded graph distance two points are from one another rather than straight-line Cartesian distance. It could also be used to compute the Space Syntax component of Depth Distance.
The third function traces a random walk over the graph from one or more starting points (the grey circles in the image above show the current position of the walk, the path is hidden from the preview). This allows one to animate HEM analyses from multiple points linked in a smooth progression as in the animation below. A Boolean toggle allows one to eliminate direct backtracking (except at dead-ends, of course) or to permit a limited amount.
This example, using the street network of Lausanne has over 12600 half-edges. Each frame calculated in just under 1 minute