Maximal matching that is not a maximum matching - graph

Is above graph maxmial but not maximum?
I went ahead and got a maximum, which is below.
Am I understanding Maximal vs. Maximum correctly?

You are right. The first graph is a maximal matching, because you can not add any more egdes to the solution. The second graph is a maximum matching, because it is (one of) the matching(s) with the highest possible sum of weights. The second graph is also a maximal matching.

Related

Calculate size of largest clique in a graph

The igraph package allows us to identify cliques within a graph fairly simply (https://igraph.org/r/doc/cliques.html). It returns lists of vertices. However, I need to simply calculate the size of the largest clique. In the documentation it mentions that the size of the largest clique can be calculated but no function is given for this task.
Other threads on the topic of cliques seem to be focused on identifying the largest clique, finding maximal cliques that meet certain criteria, counting non-overlapping cliques of a certain size, or etc. But I haven't found anything about simply reporting the size of the largest clique.
Does anyone know how to calculate the size (number of vertices) of the largest clique within a graph?
I found the function I was looking for. It's simply "clique_num"

Relationship between vertex cut and edge cut

In general is there any relationship between the minimum vertex cut and the minimum edge cut of a graph?
I'm in a situation where I have computed the minimum edge cut of a graph. Now I want to find the minimum vertex cut of the same graph, and I was wondering if I could obtain a good estimate by simply computing a vertex cut from the minimum edge cut. That is, I would simply find a subset of vertices such that they cover all the edges in the edge cut.
However, I'm not sure if this approach would actually yield a good estimate of the minimum vertex cut, hence the question.
yes. cardinality of vertex cut is K(G) is less or equal to the cardinality of edge cut.

What mean extra=101 information in rpart plot?

What mean each number with slashes between them (my plot) when is used the parameter extra=101, the documenttion said "Display the number of observations that fall in the node (per class for class objects; prefixed by the number of events for poisson and exp models)", but this is not clear for me.
How I can interpret them in my plot?
What mean the first number position and always represent the same? What mean the second number position and always represent the same? What mean the last number position and always represent the same?
Thanks!
You can refer to the [vignette] link for more information:
https://cran.r-project.org/web/packages/rpart.plot/rpart.plot.pdf
extra=101 displays the number and percentage of observations
in the node. Actually, it’s a weighted percentage using the weights
passed to rpart.

How to find total number of minimum spanning trees in a graph?

I don't want to find all the minimum spanning trees but I want to know how many of them are there, here is the method I considered:
Find one minimum spanning tree using prim's or kruskal's algorithm and then find the weights of all the spanning trees and increment the running counter when it is equal to the weight of minimum spanning tree.
I couldn't find any method to find the weights of all the spanning trees and also the number of spanning trees might be very large, so this method might not be suitable for the problem.
As the number of minimum spanning trees is exponential, counting them up wont be a good idea.
All the weights will be positive.
We may also assume that no weight will appear more than three times in the graph.
The number of vertices will be less than or equal to 40,000.
The number of edges will be less than or equal to 100,000.
There is only one minimum spanning tree in the graph where the weights of vertices are different. I think the best way of finding the number of minimum spanning tree must be something using this property.
EDIT:
I found a solution to this problem, but I am not sure, why it works. Can anyone please explain it.
Solution: The problem of finding the length of a minimal spanning tree is fairly well-known; two simplest algorithms for finding a minimum spanning tree are Prim's algorithm and Kruskal's algorithm. Of these two, Kruskal's algorithm processes edges in increasing order of their weights. There is an important key point of Kruskal's algorithm to consider, though: when considering a list of edges sorted by weight, edges can be greedily added into the spanning tree (as long as they do not connect two vertices that are already connected in some way).
Now consider a partially-formed spanning tree using Kruskal's algorithm. We have inserted some number of edges with lengths less than N, and now have to choose several edges of length N. The algorithm states that we must insert these edges, if possible, before any edges with length greater than N. However, we can insert these edges in any order that we want. Also note that, no matter which edges we insert, it does not change the connectivity of the graph at all. (Let us consider two possible graphs, one with an edge from vertex A to vertex B and one without. The second graph must have A and B as part of the same connected component; otherwise the edge from A to B would have been inserted at one point.)
These two facts together imply that our answer will be the product of the number of ways, using Kruskal's algorithm, to insert the edges of length K (for each possible value of K). Since there are at most three edges of any length, the different cases can be brute-forced, and the connected components can be determined after each step as they would be normally.
Looking at Prim's algorithm, it says to repeatedly add the edge with the lowest weight. What happens if there is more than one edge with the lowest weight that can be added? Possibly choosing one may yield a different tree than when choosing another.
If you use prim's algorithm, and run it for every edge as a starting edge, and also exercise all ties you encounter. Then you'll have a Forest containing all minimum spanning trees Prim's algorithm is able to find. I don't know if that equals the forest containing all possible minimum spanning trees.
This does still come down to finding all minimum spanning trees, but I can see no simple way to determine whether a different choice would yield the same tree or not.
MST and their count in a graph are well-studied. See for instance: http://www14.informatik.tu-muenchen.de/konferenzen/Jass08/courses/1/pieper/Pieper_Paper.pdf.

Find all spanning trees of a directed weighted graph

I have found this paper so far. Is it outdated? Are there any faster and better implementations?
By the way, Wikipedia says that there can be n^n-2 spanning trees in a undirected graph. How many spanning trees can be in a directed graph?
If you use terms from paper you mentioned and you define spanning tree of directed graph as tree rooted in vertex r, having unique path from r to any other vertex then:
It's obvious that worst case when directed graph has the greatest number of the spanning trees is complete graph (there are a->b and b->a edges for any pair).
If we "forget" about directions we will get n^{n-2} spanning trees as in case of undirected graphs. For any of this spanning trees we have n options to choose a root, and this choice define uniquely define directions of edges we need to use. Not hard to see, that all trees we get are spanning, unique and there are no nother options. So we get n^{n-1} spanning trees. Strict proof will take time, I hope that simple explanation is enough.
So this task will take exponential time depend from vertex count in worst case. Considering the size of output (all spanning trees), I conclude that for arbitrary graph, algorithm can not be significantly faster and better. I think you need to somehow reformulate your original problem to not deal with all spanning trees, and may be search only needed by some criteria.
for undirected graph only....
n^n-2 spanning tress are possible for only complete graph....to find total number of spanning trees of any graph u can apply this method.....
find the adjacency matrix of the graph.
if column values are represented by 'i' and row entries by 'j' then...
if i=j...then the value will be the degree of vertex
suppose,there is a single edge between vertex v1 and v2 then the value of matrix entry will be -1......7 if there are two edges then it will be -2...& so on...
after constructing adjacency matrix....exclude any row and column...i.e, Nth row and Nth column....
answer will be the total number of spanning tress.

Resources