Generate a graph by forming an adjacency matrix with random numbers. The

graph will have 10 nodes. The connections will be generated randomly with

the following rules.

• Each pair may have a connection with 60% probability. It means that

the connection weight for a node pair will be 0 with 40% probability.

• If a pair has a connection, the connection weight will be drawn from a

uniform distribution in the range 1 to 10. Connection weights will be

positive integer values.

• The graph is directed. Some connections may be one way and some

connections can be bidirectional.

• Each node will have a letter as label, such as 'A', 'B', 'C'

After creating the graph, implement the following functions:

• A function to generate adjacency list from the generated graph

• A function to check if the graph is connected

• If it is not connected, a function to return number of clusters (disjoint

subgraphs) with number of nodes in each cluster

• A function to return breadth-first listing of each cluster. (It will return

label list in the order of breadth-first)

• A function to return depth-first listing of each cluster

• A function to compute minimum-spanning tree for each cluster

• A function to return list of shortest path from a user given node name to

all nodes in a the cluster that node is located.

Mustafa_36
0
Newbie Poster

rproffitt
2,047
"Nothing to see here."
Moderator

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.