Let's start with n-1 lines
Build up the edges like this:
Start by connecting any point to any other point. There are n*(n-1)/2
ways to do this.
Then add edges from a connect point to an unconnected point. For the
first edge added this way, there are 2*(n-2) options. After that it is
3*(n-3), 4*(n-4)...(n-1)*1.
But that generates all of the orders in which the edges can be added,
so you have to divide out (n-1)!.
If you simplify that out, you get n!/2.

For more than n-1 lines you need to specify the constraints. Can there
be multiple edges connecting the same pair of points? Either way, look
for the pattern in the number of ways the edges can be selected and
multiply it out.

Don

On Feb 7, 10:03 pm, rspr <ravishanker....@gmail.com> wrote:
> Hi All,
>
> can there be a formula....to which we can estimate how many ways (n-1)
> lines can connect n points in the same way how many ways n lines can
> connect n points and so on....there is one way that we store the
> information in adjacency list or in adjacency matrix....and will check
> for the same for every event in sample space.....is there any other
> way that can optimize this calculation or may it possible that we can
> directly calculate it.
>
> .....
> rspr

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to