I have written a program in Skill to do this, but unfortunately, I am unable to share it. Here are links to the paper and presentation I did for the CND Users group in 2002:
The first attempt I made at this was a simple one level net highlighter that selected shapes based on their net name. This was easy to do, but required the connectivity to be correct on the shapes which was usually the case right after a route or after being in VXL. However, if the layout was edited in VLE, shapes can get moved to other nets and the connectivity can be wrong. Over time I expanded the code to simply trace shapes regardless of connectivity and to also trace hierarchically. When you work hierarchically, it gets more complicated because you can have the same cell placed multiple times and you only want to highlight the inputs or outputs connected to the current net. My basic approach was as follows:
Start at a specified point or pin in the layout. Get the shape at that point or use the specified pin to start.
Use dbGetTrueOverlaps to find all shapes on the same layer at that point. (if it is a m1 pin, look for m1 drawing, etc).
For each overlapping shape, store it as a connecting shape. If it is down in the hierarchy, store its transform as well (so it is unique).
If the shape is in a via or contact cell then you will need to look for overlaps on both connecting layers (if m1 shape is found in via1 cell, must also trace m2 in the next pass).
Take all new shapes and break them into rectangles. Foreach rectangle, look for overlaps on the same layer only, unless in a via cell when you must look for shapes on two layers.
Keep trace of shapes already processed and continue until no more shapes are found.
Hilight or select the shapes as you process them so if you ctrl-c, you'll have a partial highlight.
For performance reasons, I do not look for overlaps on the via or contact layers. We require all via/contacts to be instances. If you must look for overlaps on the via or contact layer, you will slow way down because this will add many more overlap checks.
The two most difficult things to deal with are breaking polygons into rectangles and storing off shapes and their transforms for items down in the hierarchy. For example, if you have the same via placed 10 times on a net, you need to store all 10 unique locations.
I hope this helps. This has been the most useful utility I have ever written. Nearly all of our layout designers use it daily. By keeping track of all the shapes you can do many things like measure the net, select the net, add connectivity to the net outside of VXL, find markers on the net, etc.
If all you want to do is select the net, and you can get connectivity on it with a router or VLX, then it is very simple to write Skill to deall with all shapes that have a net attribute: setof(x geGetEditCellView()~>shapes x~>net~>name=="clk")
The vias/contacts can be found by looking at instance terminals.