Ask Your Question

Vertex connecitivity incomplete (pun intended)

asked 2011-10-09 10:36:07 +0200

G-Sage gravatar image

updated 2011-10-09 12:03:36 +0200

parzan gravatar image

I am no graph theory expert, but the textbook I am learning from, and the Wikipedia article "Connecitivy (graph theory)" (which doesn't use my book as a reference, i.e., there are at least 2 books saying this) both say the vertex connectivity of a complete graph on n vertices is n-1. But, if you try to do graphs.CompleteGraph(whatever).vertex_connectivity(), it says

"There can be no vertex cut in a complete graph."

I looked at the code, and the fix is simple: Take

if g.is_clique():
    raise ValueError("There can be no vertex cut in a complete graph.")

and make it

if g.is_clique():
    return g.order()-1

But, I don't know how this fixing stuff works.

Second question, why does it return answers in the form 1.0 when the only possible values of this are integers?

Thirdly, there are a couple typos in the commenting of the code:

In a grid, the vertex connectivity is equal to the minimum degree, in which case one of the two sets it of cardinality 1::

should be "two sets IS of"

For directed graphs, the strong connexity is tested through the dedicated function::

I believe should be "strong vertex connectivity". Maybe connexity is okay but I am guessing it's a typo.

Fourthly, can we make "graph theory" a tag?

edit retag flag offensive close merge delete



I retagged according to your last sentence - if you don't like it you can change it back. Currently there are "graph", "graphs" and "graph_theory" tags - perhaps they should all be merged.

parzan gravatar imageparzan ( 2011-10-09 12:04:44 +0200 )edit

@ parzan I'm a moron. Yea, thanks for doing that. They probably shouldn't be merged. If I think graph, there's the calculus meaning and the graph theory meaning. If my problem has to do with graph theory, I'd probably use graph theory. If I'm talking about the graph of some function, I'd probably use graph.

G-Sage gravatar imageG-Sage ( 2011-10-09 12:20:38 +0200 )edit

Oops, I am a moron for thinking that "graph" is only the combinatorist's graph :)

parzan gravatar imageparzan ( 2011-10-09 12:40:32 +0200 )edit

Maybe neither of us are morons :) Just little mistakes.

G-Sage gravatar imageG-Sage ( 2011-10-09 15:42:55 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-10-09 12:58:57 +0200

Nathann gravatar image

Helloooooooo !!!

My mistake, as usual :-)

So, to answer your points :

1) The connectivity of a clique on n vertices is n-1. Yes, you are right, all the textbooks say so, this is the convention, and I just thought that "it makes no sense to look for a vertex cut in a clique" when I coded this method. I'll fix that in a patch.

2) The answer returns 1.0 instead of the expected 1. The reason is that this method also handles weighted cut, but you are right when you say that it feels odd to get a non-integer value. This is actually fixed by patch 11367 which is waiting for a reiew right now. If you want to give it a review, it will finally be merged into Sage : I can write many patches but I can not review my own patches myself :-)

3) I will fix the typ in the same patch, Thanks !

4) Well, this is actually testing for strongconnectivity but I did not find it very hard, as this is what you expect to compute when you try to compute the connectivity of a directed graph. One can cast it to an undirected graph otherwise... Do you think it is a bad idea ?


edit flag offensive delete link more


For your number 4, perhaps it's my lack of expertise. After your reply, I do recall the notion of strong connectivity, so the word "vertex" that I put above does not belong. But, there is a typo still, I think, because it says "connexity" instead of "connectivity". Any way, thanks for making this function in the first place and thanks for continuing to work on it. It makes things really simple when I'm working on stuff and a large portion of what I want is built in.

G-Sage gravatar imageG-Sage ( 2011-10-09 15:30:55 +0200 )edit

@Nathann How do I review a patch?

G-Sage gravatar imageG-Sage ( 2011-10-09 15:31:42 +0200 )edit

I just updated the patch at this address : I hope it fixes all the points you addressed ! The other patch I mentionned, 11367, just got reviewed by a colleague today, so only 11910 is left to check. Reviewing a patch is (at first) not trivial, so there is a manual for that just there : If you have any question, you can scream for help on the sage-devel google group or on our IRC channel

Nathann gravatar imageNathann ( 2011-10-12 12:55:41 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-10-09 10:36:07 +0200

Seen: 497 times

Last updated: Oct 09 '11