For this question, g
is a Graph
object (of order ~2K) such that the VertexWeight
and EdgeWeight
properties are defined for every vertex and edge, respectively, and have values in the unit interval1.
I want to implement custom functions to set g
's VertexShapeFunction
and EdgeShapeFunction
properties to. I want these functions to have this form:
(* for VertexShapeFunction *)
If[PropertyValue[{g, #2}, VertexWeight] < cutoff,
invisibleVertex,
defaultVertex[##]] &
(* for EdgeShapeFunction *)
If[PropertyValue[{g, #2}, EdgeWeight] < cutoff,
invisibleEdge,
defaultEdge[##]] &
(The symbol cutoff
represents an external parameter that I intend to modify repeatedly to affect how the graph is displayed. The intent is that as one lowers the value of cutoff
, more vertices and edges will become visible. The positions of vertices and edges should never change as one varies cutoff
.)
By dumb (and lengthy) trial-and-error, I've found that setting
invisibleVertex = Directive[Opacity[0], EdgeForm[None]];
invisibleEdge = {};
produces adequate results (although these settings are literally clueless, and I welcome more informed alternatives).
I have not found anything remotely adequate to put in the locations indicated by the placeholders defaultVertex[##]
and defaultEdge[##]
above.
Is there a way to do what I'm trying to do?
Also, FWIW, for each vertex, the value of its VertexWeight
property is the maximum of the EdgeWeight
property of all the edges incident upon it, or -1 if there are no such edges.