In Algorithm Design Manual, page 178 describes some properties of Graph, and one of them is embedded and Topological:
Embedded vs. Topological
A graph is embedded if the vertices and
edges are assigned geometric positions. Thus, any drawing of a graph
is an embedding, which may or may not have algorithmic significance.
Occasionally, the structure of a graph is completely defined by the
geometry of its embedding. For example, if we are given a collection
of points in the plane, and seek the minimum cost tour visiting all of
them (i.e., the traveling salesman problem), the underlying topology
is the complete graph connecting each pair of vertices. The weights
are typically defined by the Euclidean distance between each pair of
points.
Grids of points are another example of topology from geometry.
Many problems on an n × m grid involve walking between neighboring
points, so the edges are implicitly defined from the geometry.
I quite don't understand it:
First of all, what exactly does embedded mean here? As long as the vertices have their own geometric positions, then can I call the graph embedded?
What does any drawing of a graph is an embedding mean? Does it mean what I said in point 1?
What does Topological mean? I don't think it is explained in this description.
The examples in this description really confused me a lot. Could someone please use simplest words to let me understand these two terms for graph?
Is it really important to get these two term understood?
Thanks
I remind you that a graph is just a set of vertices and a set of edges defined on them, so the vertices don't have a geometric position of their own. A drawing of a graph is called an embedding, a drawn graph is called embedded.
It means that any way of drawing a graph is called an embedding of that graph.
A topological graph is a graph whose vertices and edges are points and arcs, respectively.
In addition to msj's answer.
Graph = G(V, E), where V is set of vertex and and E is set pair of vertices from V. This is definition of graph as per Skiena. Note how there is no mention of how this graph visually appear (i.e no mention of its topology).
Example (note that it doesn't define where a, b are located in say X,Y coordinate system)
V = { a, b, c, d, e, f } and E = { (a,b), (b,c), (a,e) }
To 'draw' a graph you assign it geometric positions e.g. in X,Y coordinate systems.
|
| b (2,3)
| a(1,2)
|
|
|____________________________
Fig 1
Fig 1 is simply an embedding where we are drawing vertex pairs specified in E
Difference between embedded and topological graph is how does the "topology" comes to be. In any "embedding" you manually assign geometric locations as explained above, but in topological graph you define a "rule" based on which topology of a graph defines itself. e.g. you specify a G(V,E) and define a rule, say "visit each node exactly once" defines the topology which is called "complete graph".
Skiena uses geographical friendship graph as an example for embedded graph because each vertex is associated with a geographical point in this world where friends live.
Excerpt from the book -
Do my friends live near me? – Social networks are not divorced from geography. Many of your friends are your friends only because they happen to live near you (e.g., neighbors) or used to live near you (e.g., college roommates).
Thus, a full understanding of social networks requires an embedded graph, where each vertex is associated with the point in this world where they live. This geographic information may not be explicitly encoded, but the fact that the graph is inherently embedded in the plane shapes our interpretation of any analysis.
Related
This problem may be related to this post.
This problem also asked here but with a different taste.
Consider an (undirected) square graph with a periodic boundary condition. Then find a complete cycle graph with length equal to 4. now I want to assign a unique representative to each cycle from its elements. Therefore in a square graph with n_v vertex i will find n_f=n_v 4-cycles and n_v representative for the cycles. For the square graph, everything is simple. just assign the bottom left vertex of each plaque(4-cycles).
(i just show first 4-cycle)
Now, I want to generalize it for other structures. consider (undirected) kagome graph with proper boundary condition,
(here I just show 3 distinct cycles)
In this case for assigning a vertex to cycles cover, you need three different length cycles. which show by similar color with the assigned vertex. However, now I want to generalize this to other complicated graphs. I want to know is this problem has a name and about its possibility or algorithm. For example, we cannot do it in a triangular graph:
This problem solved here.
I)Let show all faces and vertices by \alpha_i, where i contain
vertices and faces.
II) make a graph which relates \alpha_i (from i
in face group) to \alpha_j (to j in vertex group), if j(vortex)
belong to i(face).
III) find the independent edge set of this
graph gives for any vortex a face.
Please see here for additional information.
Give an example of a graph that has the following properties. (Note that you need to give a single graph as the answer.)
The graph does not contain a triangle (that is, a clique of 3 vertices) as a subgraph.
Graph needs at least 4 colors for a proper vertex coloring
[If you think that such a graph is not possible, then prove that statement.]
1.Tomorrow we have a final exam, and this question may on the exam paper.
2.I think it is impossible to draw such a graph. But how to prove? Thank u very much.
A web search finds https://en.wikipedia.org/wiki/Gr%C3%B6tzsch_graph
The Grötzsch graph is a member of an infinite sequence of triangle-free graphs, each the Mycielskian of the previous graph in the sequence, starting from the null graph; this sequence of graphs was used by Mycielski (1955) to show that there exist triangle-free graphs with arbitrarily large chromatic number. Therefore, the Grötzsch graph is sometimes also called the Mycielski graph or the Mycielski–Grötzsch graph. Unlike later graphs in this sequence, the Grötzsch graph is the smallest triangle-free graph with its chromatic number (Chvátal 1974).
I've got a DAG of around 3.300 vertices which can be laid out quite successfully by dot as a more or less simple tree (things get complicated because vertices can have more than one predecessor from a whole different rank, so crossovers are frequent). Each vertex in the graph came into being at a specific time in the original process and I want one axis in the layout to represent time: An edge relation like a -> v, b -> v means that a and b came into being at some specific time before v.
Is there a layout algorithm for DAGs which would allow me to specify the positions (or at least the distances) on one axis and come up with an optimal layout regarding edge crossovers on the other?
You can make a topological sorting of the DAG to have the vertices sorted in a way that for every edge x->y, vertex x comes before than y.
Therefore, if you have a -> v, b -> v, you will get something like a, b, v or b, a, v.
Using this you can easily represents DAGs like this:
Yes, as #Arturo-Menchaca said a topological sorting may help to reduce overlapping count of edges. But it may be not optimal. There is no good algorithm for edge crossing minimization. Problem for crossing minimization is NP-complete. The heuristics are applied for solving this problem.
This StackOverflow link may help you: Drawing Directed Acyclic Graphs: Minimizing edge crossing?
I suppose your problem is related to an aesthetically pleasing way of the graph layout. Some heuristics are described in the articles Overview of algorithms for graph drawing, Force-Directed Drawing Algorithms. May be information about planar graph or almost planar graph can help you also.
Some review of the algorithms for checking and drawing planar graphs are described in the Wiki pages Planar graph, Crossing number (graph theory). The libraries and algorithms for planar graph drawing are described in the StackOverflow question How to check if a Graph is a Planar Graph or not? For example the author in the article GA for straight-line grid drawings of maximal planar graphs uses genetic algorithms for straight-line grid drawing.
Good descriptions for almost planar graphs are given in the articles Straight-Line Drawability of a Planar Graph Plus an Edge, On the Crossing Number of Almost Planar Graphs.
Try to modify the original algoritms using your condition with one axis alignment.
If I understood you correctly then you want to minimize the number of edge-crossings in your graph layout. If so, then the answer is "No", because this problem is proved to be NP-complete in the general case. See this, "Crossing Number is NP-Complete, Garey, Johnson".
If you need a not an optimal but just good enough solution, there are multiple articles on this topic because it is heavily related with circuit layouts. Probably googling "crossing number heuristics" and looking through the abstracts of some papers will solve your task better then me trying to guess blindly your requirements.
I'm implementing DFS and edge classification for college (based on the code provided in this paper: https://courses.csail.mit.edu/6.006/fall11/rec/rec14.pdf).
I've used this graph as a test:
The letters in italic are simply the vertices' names, while the numbers inside the vertices are discovery and finalization time, respectively. Edges are classified as Back, Forward or Cross; all else are tree edges.
As you can see, this graph was visited in the following order: first s, then its neighbors (following DFS); when there were no more accessible neighbors, visitation began on t.
In order to test our algorithm, the teacher will provide a text file with each edge as a line. When performing the DFS, I simply follow the order of appearance in the file for each vertex; in this case, that would be first s and then v, not t. This in turn gives a different edge classification: t to v is considered a cross edge, t to u a back one and u to t a tree one.
Is this behavior normal? Does the order of exploration affect the final edge classification? If so, are both classifications, mine and the example's, correct? If not, is there any way I can know which vertex to explore first?
Is this behavior normal? Does the order of exploration affect the final edge classification?
Absolutely. The order in which the algorithm chooses edges for exploration decides edge classification in cases when there are any back or cross edges (i.e. when the graph is not a tree.)
If so, are both classifications, mine and the example's, correct?
Yes, both classifications are correct, as long as there is no specific order of exploration requested by the problem setter.
If not, is there any way I can know which vertex to explore first?
The problem may specify a particular order of exploration - for example, the graph on your picture appears to be traversed in reverse alphabetical order of vertex naming: z before w from s, y before w from z, and v before u from t.
Below is the exercise 5.25 in 《Introduction to algorithms, a creative approach》. After reading it several times, I still can't understand what it means. I can color a tree with 2 colors very easily and directly using the method it described, not 1+LogN colors.
《Begin》
This exercise is related to the wrong algorithm for determining whether a graph is bipartite, described in Section 5.11.In some sense, this exercise shows that not only is the algorithm wrong, but also the simple approach can not work. Consider the more general problem of graph coloring: Given an undirected graph G=(V,E), a valid coloring of G is an assignment of colors to the vertices such that no two adjacent vertices have the same color. The problem is to find a valid coloring, using as few colors as possible. (In general, this is a very difficult problem; it is discussed in Chapter 11.)
Thus, a graph is bipartite if it can be colored with two colors.
A. Prove by induction that trees are always bipartite.
B. We assume that the graph is a tree(which means that the graph is bipartite). We want to find a partition of the vertices into the two subsets such that there are no edges connecting vertices within one subset.
Consider again the wrong algorithm for determining whether a graph is bipartite, given in Section 5.11: We take an arbitrary vertex, remove it, color the rest(by induction), and then color the vertex in the best possible way. That is, we color the vertex with the oldest possible color, and add a new color only if the vertex is connected to vertices of all the old colors. Prove that, if we color one vertex at a time regardless of the global connections, we may need up to 1+logN colors.
You should design a construction that maximizes the number of colors for every order of choosing vertices. The construction can depend on the order in the following way.
The algorithm picks a vertex as a next vertex and starts checking the vertex’s edges. At that point, you are allowed to add edges incident to this vertex as you desire, provided that the graph remains a tree, such that, at the end, the maximal number of colors will be required. You can not remove an edge after it is put in(that would be cleanining the algorithm, which has already seen the edge). The best way to achieve this construction is by induction. Assume that you know a construction that requires<=k colors with few vertices, and build one that requires k+1 colors without adding too many new vertices.
《End》