# Graph Lkhagva

## 2099 days ago by bigdata2016

1. Graph and Adjacency matrix of its

G=Graph({1:[3,4,6],2:[5,4]}); html('A graph $G$ ') G.show() G1=Graph() A=G.adjacency_matrix() G1=Graph([ [1..n], lambda x,y: x+y>n and abs(x-y)>0]) A1=G1.adjacency_matrix() html('A graph $G_1$ ') show(G1) html('An adjacency matrices of $G$ and $G_1$ are $%s, %s$ respectively'%(latex(A),latex(A1)))
 A graph $G$ A graph $G_1$ An adjacency matrices of $G$ and $G_1$ are $\left(\begin{array}{rrrrrr} 0 & 0 & 1 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 1 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 \end{array}\right), \left(\begin{array}{rrrrrrr} 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 0 \end{array}\right)$ respectively A graph A graph An adjacency matrices of and are respectively

2. Largest eigenvalue of a clique with n vertices is n-1

n=8 G= graphs.CompleteGraph(n); html('A clique with $%s$ vertices is '%(n)) show(G) A=G.adjacency_matrix() html('Adjacency matrix of a graph $G$ is $%s$'%(latex(A))) ev=A.eigenvalues() html('The largest eigenvalue of a clique with %s vertices is %s'%(n, ev[0])) L=G.laplacian_matrix()
 A clique with $8$ vertices is Adjacency matrix of a graph $G$ is $\left(\begin{array}{rrrrrrrr} 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 0 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 0 \end{array}\right)$ The largest eigenvalue of a clique with 8 vertices is 7 A clique with vertices is Adjacency matrix of a graph is The largest eigenvalue of a clique with 8 vertices is 7

3.a Here is a graph of order n such that every degree of vertices is k. Where k is even.

Then largest eigenvalue equal to k

n=7 k=4 G=Graph([ [1..n], lambda x,y: abs(x-y)<k/2+1 or n-abs(x-y)<k/2+1],\ loops=False) show(G) A=G.adjacency_matrix() ev=A.eigenvalues() html('Adjacency matrix of a graph $G$ is $%s$'%(latex(A))) html('The largest eigenvalue of a graph $G$ is %s'%(ev[0]))
  Adjacency matrix of a graph $G$ is $\left(\begin{array}{rrrrrrr} 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 1 & 0 & 1 & 1 & 0 & 0 & 1 \\ 1 & 1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 0 & 1 & 1 & 0 & 1 \\ 1 & 1 & 0 & 0 & 1 & 1 & 0 \end{array}\right)$ The largest eigenvalue of a graph $G$ is 4  Adjacency matrix of a graph is The largest eigenvalue of a graph is 4

3.b Here is a graph of order n such that every degree of vertices is k. Where k is odd and n is even.

Then largest eigenvalue equal to k

n=8 k=5 G=Graph([ [1..n], lambda x,y: abs(x-y)<int(k/2)+1 or n-abs(x-y)<int(k/2)+1 or (abs(x-y)<int(n/2)+1 and abs(x-y)>int(n/2)-1)],\ loops=False ) show(G) A=G.adjacency_matrix() ev=A.eigenvalues() html('Adjacency matrix of a graph $G$ is $%s$'%(latex(A))) html('The largest eigenvalue of a graph $G$ is %s'%(ev[0]))
  Adjacency matrix of a graph $G$ is $\left(\begin{array}{rrrrrrrr} 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 \\ 1 & 0 & 1 & 1 & 0 & 1 & 0 & 1 \\ 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 1 & 0 & 1 \\ 1 & 1 & 0 & 1 & 0 & 1 & 1 & 0 \end{array}\right)$ The largest eigenvalue of a graph $G$ is 5  Adjacency matrix of a graph is The largest eigenvalue of a graph is 5