Constructing and Manipulating Graphs![]() While many other Demonstrations exist already relating to two-dimensional graphs, none of them allows you to freely create, color and manipulate graphs. Options "store" and "restore" allow you to keep a backup version of your graph in memory. Note that the default setup is already stored in the backup (hit "clear" and then "restore" to test it). Options "N","S","E","W" shift the whole graph to the North, South, East or West, one unit at a time. You can add a new vertex at any time with Command+Click (Alt+Click on Windows or Option+Click on the Mac). You can also delete an existing vertex with Command+Click! Warning: do not create new vertices too quickly after each other, since this can lead to system errors. You can switch the display of the vertex numbers off. You can also select to show the "degrees" of each vertex, which is the number of edges connected to a vertex. As a third option ("distance"), you can show the graph distance (degree of separation) of each vertex in relation to the selected "from" vertex. Note that the degree of separation on a directed graph is different from the one on an undirected graph (click "directed" to switch between these cases). Option "number offset" lets you choose where the notation should be in relation to the vertices and edges (North, South etc). Clicking option "deg v" color-codes all vertices according to their degree, i.e., by the number of edges converging there (degrees 0,1,2,3,4,5,6,>6, correspond to colors red, orange, green, cyan, blue, purple, gray, black). Option "dist v" color-codes all vertices according to their graph-distance from the "from" vertex (distances 0,1,2,3,4,5,>5,∞ correspond to colors red, orange, cyan,green, blue, purple, gray, black). Please note that the degree of separation on a directed graph is different from the one on an undirected graph (click "directed" to switch between these cases). The special case ∞ (color-coded black) denotes all parts of the graph that cannot be reached at all form the "from" vertex. The option "dist v+e" color-codes all vertices and edges according to their graph-distance from the "from" vertex. Color the vertex with the "col" option. Option "c e" re-colors all edges (!) connected to the selected vertex. Option "c r" re-colors all vertices with numbers in the range between "from" and "to". You might have to switch off the automatic color coding (described above) first. Option "s" splits a vertex into two vertices, with the new vertex having the same connections to other vertices. Option "u" unites the two vertices selected in "from" and "to", with the new vertex having the sum of the connections. "del" deletes the selected vertex. Option "d r" deletes all vertices with numbers in the range between "from" and "to". If you delete a vertex, the remaining vertices are renumbered. For technical reasons you cannot delete the last remaining vertex. Therefore the "clear" option leaves a single vertex at the bottom-left corner. If "from"="to", a little loop will be created. The small loop will be created using the opposite of the "number offset". Hence if "number offset" is S (South), then the loop will be to the North of the vertex. This keeps numbers and loops separate for better readability. Clicking "+" for an EXISTING edge switches an arrow from unidirectional to bidirectional and vice versa. (By the way: in directional graphs the edges are called "arcs".) Option "r*" reverses all edge directions. Note that the direction of an edge is only visible when you select the "directed" option. In this Demonstration either all edges of a graph have directions or none have. A graph with directions is called a directed graph. Option "c" re-colors the selected edge. You might have to switch off the automatic color coding (described above) first. Note that coloring of all edges connected to the "from" vertex is covered above in the paragraph "Vertices". Often graphs in science are presented as a linear or circular arrangement of vertices. For this reason this Demonstration offers you a convenient tool to create such arrangements with a single mouse click: The "star" option creates a circular arrangement of vertices around the "from" vertex, where all additional vertices are connected to the central vertex. Option "complete circle" creates a circular arrangement of vertices around the "from" vertex, where all additional vertices are connected with each other (but not with the center). Variables "amount" and "radius" define the number of new vertices and their distance from the "from" vertex. The special option "complete graph" does NOT add any vertices, it rather adds all missing edges between any existing vertices. You can add a new vertex at any time with Command+Click (Alt+Click on Windows or Option+Click on the Mac). In the "connect to" drop-down menu you can choose "last" to automatically connect the new vertex to the "last" vertex created (the one with the highest number), or choose "from" to automatically connect to the "from" vertex or choose "from,to" to connect to both the "from" and "to" vertex. You can also choose to connect to a range of vertices or to all vertices. ![]() "Constructing and Manipulating Graphs" from The Wolfram Demonstrations Project http://demonstrations.wolfram.com/ConstructingAndManipulatingGraphs/ Contributed by: Karl Scherer Additional contributions by: Ed Pegg Jr |
![]() | ||
|
|
||















Browse all topics















