Answered step by step
Verified Expert Solution
Question
1 Approved Answer
by simply looking at the graph. In this problem we will see that linear algebra can be used to decide if a graph contains a
by simply looking at the graph. In this problem we will see that linear algebra can be used to decide if a graph contains a triangle.
a The adjacency matriz A of a graph G with n nodes is a nn matrix defined as follows. The rows and columns of A are indexed by the node labels n and the i jentry of A is if the pair ij is an edge in G and otherwise. An example can be seen in Problem A on page in Strang's book. See also Chapter of the lecture notes.
Write down the adjacency matrix of the graph G shown above.
b Let B A where A is the adjacency matrix of G The entry b ij in B is the dot product of two vectors sitting in A Which vectors are they? In our example, how is b formed?
c For three nodes i k from G argue that a ik a kj is exactly when k is a common neighbor of i and j
d Using the above, what does b ij count?
e The nodes i jk form a triangle if and only if i and jare neighbors and k is a common neighbor of i and j If i j k is a triangle what property must a ij and b ij have?
f Putting all this together can you construct an algorithm that takes as input two indices and determines whether or not there exists a triangle with the edge between i and jas one of the sides. Justify your algorithm. Think of an algorithm that uses A and B If you use only A you will likely have a less efficient algorithm. You don't need to write computer code, just writing out the steps in words is enough.
goptional If you know about running times of algorithms, do you see how fast this algorithm runs? Is it faster than checking all triples of nodes in G
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started