Can the standard VertexContract or VertexReplace functions display a name for the collapsed node ?
Here is a minimal example:
`adg = Graph[{"U" \[DirectedEdge] "D", "D" \[DirectedEdge] "T", "T" \[DirectedEdge] "Q"}, VertexLabels -> "Name"]` VertexList @ % {"U", "D", "T", "Q"} VertexContract displays an anonymous node, even though the name is the list:
adgagg2 = VertexReplace[SimpleGraph @ VertexContract[adg, {"D", "T"}], "D" -> "B"] VertexList[adgagg2] (*{"U", "B", "Q"}*) VertexReplace removes the labels in the display:
adgagg = SimpleGraph@VertexReplace[adg, {"D" -> "B", "T" -> "B"}] VertexList[adgagg] (*{"U", "B", "Q"}*) Just wondering if I am missing a simple option somewhere. Clearly this can be addressed programmatically.
Best
Trad.
adgagg = SimpleGraph[VertexReplace[adg, {"D" -> "B", "T" -> "B"}], VertexLabels -> "Name"]? $\endgroup$SetProperty[VertexReplace[adg, "D" -> "B"], VertexLabels -> "Name"]$\endgroup$