So I was reading the documentation on the FindPostmanTour function and in several places I see graphs being directly shown without any obvious method by which they were constructed, leading me to believe that there is some built-in interface in the Notebook for doing so.
For instance, under Basic Examples the very first example is assigned g
to a graph directly. And under Applications there is an assignment to g
directly from another more complicated and neatly formatted graph. There is a second example and it shows another graph formatted a bit differently again. There are more examples, but they all involve a variable being assigned directly to a graph representation of a graph, not an expression that would construct such a graph.
In trying to figure this out I came up the old GraphEdit function but it says:
As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System
suggesting to me that this function is either directly in V10 without needing to load GraphUtilities, or that there is a new and better way to do this. Yet GraphEdit
is not recognized in the global context, and I haven't figured out a better way to do it. I also found this question which directly suggests using this old and apparently obsolete function!
So how are these graphs being directly entered without needing to come up with an expression to represent the graph first? How can I enter these graphs directly? I can copy/paste the example and see a few things I can do right-clicking, but I don't seem to be able to actually edit the graph that way either.
Graph
is evaluated, you can copy and paste the output. To see the code that generated the output, useInputForm
orFullForm
on the graph. $\endgroup$g = CompleteGraph[4];
Then selectCompleteGraph[4]
and, on a Mac, evaluate in place by typing CMD-Return. (Maybe Alt-Return on Windows?). Then you get something that looks like what you see in the docs. To get exactly what you see, one could enter whatever and evaluate it in place. $\endgroup$InputForm
shows how the graphs were constructed. It might, butGraph[input]
usually processes the input into a canonical form. Some ways to generate a graph: draw the graph and convert its image to aGraph
; programmatically generate an adjacency matrix; alter a graph, likeGridGraph[{6,8}]
;Import
an externally generated graph from a standard format. One can highlight/annotate a graph after it has been constructed. $\endgroup$