Google Answers Logo
View Question
 
Q: data Structure and Algorithm in Java (Graph Problem) ( Answered,   0 Comments )
Question  
Subject: data Structure and Algorithm in Java (Graph Problem)
Category: Computers > Algorithms
Asked by: math01-ga
List Price: $5.00
Posted: 29 Jun 2003 07:39 PDT
Expires: 29 Jul 2003 07:39 PDT
Question ID: 223121
Given a graph with 100 vertices and 600 edges. How many edges must be
added to make the graph a complete graph.
Answer  
Subject: Re: data Structure and Algorithm in Java (Graph Problem)
Answered By: rhansenne-ga on 29 Jun 2003 08:12 PDT
 
Hi math01-ga,

A complete graph with n vertices always has n*(n-1)/2 edges.

This can be simply deduced by the fact that in a complete graph with n
vertices, every vertice is connected to the n-1 other vertices. So
that way we count n*(n-1) edges. Of course we counted every edge two
times that way, since every edge is connected to 2 vertices.

A mathematical proof can be constructed using the induction theory.
I'm assuming you're familiar with the concept of mathematical
induction. If this isn't the case, I provided some additionnal links
explaining induction theory.


The proof: Proof by induction on n. Let P(n) be the predicate, A
complete graph on n vertices has n(n-1)/2 edges.

Base case: P(1) is true because a complete graph on a single node has
no edges and 1(1-1)/2=0.

Inductive step: For n > 1 assume that P(n) is true in order to show
that P(n+1)
is true.

Let G(n) be a complete graph on n vertices. P(n) says that a complete
graph on n vertices has n(n-1)/2 edges. Thus G(n) has n(n-1)/2 edges.

If we add a new node x to G(n) and add n edges, one from each node in
G(n) to x, then we have created a complete graph on n+1 vertices. Call
this graph G(n+1). The number of edges in G(n+1) is equal to the
number of edges in G(n), n(n-1)/2 plus the number of edges we added,
n. Therefore the number of edges in G(n+1) = n(n-1)/2+n, which is
n(n+1)/2.

Thus P(n) => P(n+1) and by the principle of mathematical induction,
a complete graph on n vertices has n(n-1)/2 edges. 


So if we apply this to a graph G(100) with 100 vertices, we would need
to add 100*99/2 edges, minus the 600 already existing edges. In other
words, we would need to add 4350 edges to turn it into a complete
graph.


If you need any further explanation, just let me know. 

Best regards,

rhansenne-ga.


Search terms used: "complete graph" "induction" "edges" "vertices"

The proof by induction, as well as an illustration can be found here
(proof #4 on the page):

http://www.cs.dartmouth.edu/~cs21/midterm1_sol.pdf


Some links on mathematical induction: 
 
Google Search on Mathematical Induction: 
://www.google.be/search?q=%22mathematical+induction%22 
 
Understanding Mathematical Induction: 
http://www.cc.gatech.edu/people/home/idris/AlgorithmsProject/ProofMethods/Induction/UnderstandingInduction.html
 
Mathematical Induction by Peter Suber 
http://www.earlham.edu/~peters/courses/logsys/math-ind.htm 
 
Mathematical Induction at California State University 
http://zimmer.csufresno.edu/~larryc/proofs/proofs.mathinduction.html 
 
Examples of Mathematical Induction at CSUSB: 
http://www.math.csusb.edu/notes/proofs/pfnot/node10.html
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy