function [M] = RandomGraph(n,p)
%The input are scalars n and p and the output is M, the Laplacian matrix of a
%graph with n vertices having a probability p of connection.
Rand=rand(n,n);
%Rand is a n by n matrix whose entries are random numbers between 0 and 1.
%This block of code will replace all entries in the upper diagonal matrix of Rand
%less than p with 1 and those entries greater than or equal to p with 0.
%Each entry in the lower diagonal matrix is set equal to the corresponding
%entry in the upper diagonal matrix.
%This creates the adjacency matrix of the random graph being produced.
for i=1:n
for j=1:i-1
if Rand(i,j)