katz.cent <- function(A, alpha=NULL, beta=NULL){ #NULL sets the default value
  if (class(A) == 'igraph'){
    #Error checking. Turn into adj matrix.
    A <- get.adjacency(A)
  }
  
  lam.dom <- eigen(A)$values[1] #dom eigenvec
  if (is.null(alpha)){
      if(lam.dom == 0)
        alpha = 0.1
      else
        alpha <- 0.9 * (1/lam.dom) #Set alpha to 90% of max allowed
    if (is.complex(alpha)){
      alpha <- Re(alpha)
    }
  }
  
  n <- nrow(A)
  if (is.null(beta)){
    beta <- matrix(rep(1/n, n),ncol=1)
  }
  
  #Katz scores
  scores <- solve(diag(n) - alpha*A,beta)

  return(scores)
}
