Compute degree centrality of an undirected graph – Software Engineering
1. Compute the degree centrality, betweeness centrality, closeness centrality of nodes within the following graph.
2. A okay-common undirected community is a community during which each vertex has degree ??. Present that the vector ?? = (1, 1, 1, . . . , 1) is an eigenvector of the adjacency matrix with eigenvalue ??.
three. Think about an undirected tree of n vertices. A selected edge within the tree joins vertices 1 and a couple of and divides the tree into two disjoint areas of n1 and n2 vertices as sketched right here:
Present that the closeness centralities ??1 and ??2 of the 2 vertices are associated by
four. Calculate the betweenness centrality of the ??th vertex from the tip of a “line graph” of n vertices. Right here a line graph on n vertices 1, 2, three,…, n has precisely n – 1 edges that join vertices ?? and ?? + 1, for ?? = 1,…, n – 1.
5. Write a program in your most popular programming language to compute degree centrality of an undirected graph. This system will learn the graph from a file referred to as “graph.txt” and output the degree centrality of nodes to a file referred to as “degree.txt”.
The file “graph.txt” consists of multiples traces during which the primary line incorporates two integers n and m that correspond to the quantity of nodes and edges within the graph. Every of the next m traces include two integers u and v, separated by one area, to indicate an edge from u to v. Nodes are numbered from 1 to n.
The output file “degree.txt” incorporates precisely n traces during which the ????h line is the (unnormalized) degree centrality of node ??.
Your submission should embrace
– The supply file(s)
– The pattern enter/output
– A README file that describes the compile and operating instruction
6. Write a program in your most popular programming language to compute (normalized) closeness centrality of an undirected graph. This system will learn the graph from a file referred to as “graph.txt” and output the degree centrality of nodes to a file referred to as “closeness.txt”.
The file “graph.txt” consists of multiples traces during which the primary line incorporates two integers n and m that correspond to the quantity of nodes and edges within the graph. Every of the next m traces include two integers u and v, separated by one area, to indicate an edge from u to v. Nodes are numbered from 1 to n.
The output file “closeness.txt” incorporates precisely n traces during which the ????h line is the (normalized) closeness centrality of node ??.
Your submission should embrace
– The supply file(s)
– The pattern enter/output
– A README file that describes the compile and operating instruction