How can I remove nodes without edges from my graph before plotting with dot -Tpng mcve.gv -o mcve.png?
Current Result:
Wanted Result:

Reading the documentation and searching the web I found the following answer which seems fine at first glance. (remove all nodes with 0 edges)
vpr -c 'N[$.degree==0]{delete($);}' mvce.gv | dot ...
Unfortionately this command gives the following error:
gvpr: "<command line>", line 2: delete($)<<<
-- cannot convert node_t to graph_t
Which seems weird as from what I read N[predicate]{action} should only execute action on nodes.
A minimal example of my graph:
graph main_graph {
node1;
node2;
node3;
node4; // not used
subgraph graph1 {
edge [color=red,penwidth=2]
node1 -- node2;
}
subgraph graph2 {
edge [color="blue",penwidth=2]
node2 -- node3;
node1 -- node3;
}
}