Graph Processing. Let G be a graph of N nodes represented by a NxN Boolean adjacency matrix, which (by abuse of notation
Posted: Sun May 15, 2022 8:39 am
Graph Processing.
Let G be a graph of N nodes represented by a NxN Boolean
adjacency matrix, which (by abuse of notation) we will also call
G.
a. Graph G is said to be transitive if and only if
whenever there is an arc from node I to node J and an arc from node
J to node K in G, then there is necessarily an arc from node I to
node K in G. Write a Boolean function transitive(), which takes a
graph as a parameter and returns TRUE if and only if G is
transitive.
b. Graph G is said to be connected if and only if
for any node I and node J, there is a path from I to J in G. Write
a Boolean function connected(), which takes a graph G as a
parameter and returns TRUE if and only if G is transitive.
You may assume that you have two functions available to
you:
transitiveclosure(G,G+): This function takes G as input and returns
its transitive closure in G+.
path2(G,G2): This function takes G as input and returns in G2 the
graph that has an arc from node I to node J whenever G has a path
of length 2 from I to J.
Let G be a graph of N nodes represented by a NxN Boolean
adjacency matrix, which (by abuse of notation) we will also call
G.
a. Graph G is said to be transitive if and only if
whenever there is an arc from node I to node J and an arc from node
J to node K in G, then there is necessarily an arc from node I to
node K in G. Write a Boolean function transitive(), which takes a
graph as a parameter and returns TRUE if and only if G is
transitive.
b. Graph G is said to be connected if and only if
for any node I and node J, there is a path from I to J in G. Write
a Boolean function connected(), which takes a graph G as a
parameter and returns TRUE if and only if G is transitive.
You may assume that you have two functions available to
you:
transitiveclosure(G,G+): This function takes G as input and returns
its transitive closure in G+.
path2(G,G2): This function takes G as input and returns in G2 the
graph that has an arc from node I to node J whenever G has a path
of length 2 from I to J.