Answer the question
In order to leave comments, you need to log in
How to generate a directed graph with N number of paths?
Good afternoon.
It is necessary to write an algorithm that will generate a directed graph, with the exact number of possible options for moving between points A and B.
That is, we have 2 points, let's conditionally call point A the sending point, and point B the delivery daughter.
In the simplest case, we have 2 nodes A and B and one edge between them.
If we pass 4 as input to the algorithm, for example, it should return a random directed graph, in which there are only 4 options for moving between A and B.
I would be grateful for any hints
Answer the question
In order to leave comments, you need to log in
We find a partition of the number of paths into prime factors. We build additional layers between points A and B, in each of which the number of points corresponds to the next factor. We connect point A with all points of the first layer, each of the points of the first layer with all points of the second layer, etc., all points of the last layer with point B.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question