1

I'm trying to find an answer to a problem in my Distributed Algorithms course, and to do so I want to get something clarified.

  1. What is the diameter of a graph with one node, with an edge to itself? Is it 1 or 0?

If you are interested, the question to which I'm trying to find an answer is this:

In terms of n (# nodes), the number of messages (= diam * |E|) used in the FloodMax algorithm is easily seen to be O(n^3). Produce a class of digraphs in which the product (diam * |E|) really is Omega(n^3).

The digraph I came up with is a graph with just one node, which has a directed edge to itself. That way |E| would be 1 which is n^2, and if the diam is 1, it satisfies the second condition where diam = 1 = n as well. So it gives me a class of digraphs with message complexity being Omega(n^3).

So am I correct in my thinking, that in such a graph the diameter is 1?

Sach
  • 10,091
  • 8
  • 47
  • 84
  • It depends on how you define min distance d(a,b) on your graph. If the node is x and d(x,x) = 1, then the diameter is 1. It's unusual to define distance this way, but there's no rule against it. – Gene Mar 08 '15 at 23:38
  • @Gene: The usual properties of a distance function are a rule against it. See axiom 2 http://en.wikipedia.org/wiki/Metric_(mathematics). – Douglas Zare Mar 09 '15 at 21:33
  • @DouglasZare That would be why I said it's unusual! – Gene Mar 10 '15 at 02:15

2 Answers2

0

Two things:

  1. It seems to be 0 according to this, which says:

    In other words, a graph's diameter is the largest number of vertices which must be traversed in order to travel from one vertex to another when paths which backtrack, detour, or loop are excluded from consideration.

  2. Your solution to the given problem should describe how to build a graph (or rather say what type of known graph has that property, since it says "produce a class") with n nodes, not a graph with however many nodes you manually figured out a solution for. I can do the same for 2 nodes:

    1 -- 2
    
    |E| = 1 = (1/4)*2^2 = (1/4)*n^2 = O(n^2)
    diam = 1 = 2 - 1 = n - 1 = O(n)
    tada!
    

    Or here's how we can make your solution work even if the diameter is 0: 0 = 1 - 1 = n - 1 = O(n) => your solution still works!

    So even if you considered paths with loops as well, I would still deem your solution incorrect.

IVlad
  • 43,099
  • 13
  • 111
  • 179
  • Thanks! The answer to 1.) seems to be pretty clear. However, I didn't quite understand your explanation. According to the problem I need to produce a class of digraphs were message complexity is Omega(n^3) which means that class of graphs must always use at least n^3 messages to complete FloodMax algorithm. From your explanation, what I understand, is you're showing me that a graph with 1 (or 2) nodes is still bounded from above (hence Big-Oh) by n^3. Can you please further explain it? – Sach Mar 08 '15 at 23:31
  • @Sach - what I mean to say is that you can't just pick a few nodes and construct a graph that fits and be done with it. You need to say how it's done for `n` nodes. Find something that works for all values of `n`. – IVlad Mar 09 '15 at 09:29
  • I understand now. But the more I think about this the more it looks like this is impossible; because if I have a class of graphs with maximum number of edges possible, which is n^2, then the diameter is going to be just 1. On the other hand there cannot possibly be a graph with diameter > n. So either way it looks like a dead end to me, but my professor says that such a class of graphs exists, and that I don't even have to consider edge weights. – Sach Mar 10 '15 at 01:12
0

O(n^3) and Omega(n^3) do not mean cn^3, and there is no problem with a function that is 0 at finitely many nonzero values of n being in O(n^3) and Omega(n^3). For example, n^3-100 is in both, as is n^3-100n^2. For the purposes of asymptotics, it is unimportant what the diameter is for a single example. You are asked to find an infinite family of graphs with large enough diameters, and a single example of a graph doesn't affect the asymptotics of the infinite family.

That said, the diameter of a graph (or strongly connected digraph) can be defined in a few ways. One possibility is the greatest value of half of the minimum of the length of a round trip from v to w and back over all pairs v and w, and that is 0 when v and w coincide. So, the diameter of a graph with one vertex is 0.

Again, this doesn't help at all with the exercise that you have, to construct an infinite family. A family with one node and lots of edges back to itself isn't going to cut it. Think of how you might add many edges to graphs with large diameter, such as an n-cycle or path, without decreasing the diameter that much.

Douglas Zare
  • 3,296
  • 1
  • 14
  • 21
  • Regarding your last para, I understand I need to find a graph with many edges without decreasing the diameter. One such graph I could think is a ring network, but even then I need to have at least n^3 messages, meaning either a.) I need diam >= n and |E| >= n^2 or b.) diam >= n^2 and |E| >= n. But either seems a dead end. What am I missing? – Sach Mar 10 '15 at 01:20
  • 1
    @Sach: It sounds like you are missing that there can be constant factors in the asymptotic comparisons. If you make a family of graphs with diameter n/10 with n^2/10 edges, that means diameter*|E| is O(n^3) and Omega(n^3). – Douglas Zare Mar 10 '15 at 04:50