3
$\begingroup$

I have a number of nodes, each with a numeric label and arbitrary connections between these nodes. When I plot the graph I would like nodes similar in value to be colocated as far as possible within the constraints of the arbitrary connections above. My first thought is to create extra connections between nodes sharing similar values, but if I then plot such a graph those connections will obscure the graph of arbitrary connections.

My question then becomes how can I make the edges in the latter set invisible, so the connections influence the layout of the former without obscuring the plot?

$\endgroup$
3
  • 1
    $\begingroup$ please share the code that produces the plot $\endgroup$ Commented Feb 27, 2020 at 14:46
  • 2
    $\begingroup$ HighlightGraph[CompleteGraph[5], {Style[UndirectedEdge[3, 4], Opacity[0]]}] $\endgroup$ Commented Feb 27, 2020 at 15:08
  • 1
    $\begingroup$ If edgestohide is the the list of edges to be hidden in graph g, you can use Graph[g, EdgeStyle->{Alternatives@@edgestohide ->Opacity[0]}] ; or, to remove those edges, Graph[EdgeDelete[g, edgestohide], VertexCoordinates->GraphEmbedding[g]] $\endgroup$ Commented Feb 28, 2020 at 10:45

1 Answer 1

1
$\begingroup$

Compute the vertex coordinates for your modified graph (GraphEmbedding) then transfer them to the original graph (VertexCoordinates option).

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.