graphgraph-theorylongest-path

How can I convert every path of a directed weighted graph to equal cost ? (see description)


Can we convert a directed weighted graph in such a way that each of its path from a specified source to destination is of equal cost? The cost of each of the path should be equal to the maximum cost path in original graph. How to convert any directed weighted graph to such type of graph? Is it possible to convert every directed weighted graph into such type of graph?

Source and destination of graph is predefined.


Solution

  • It is possible to convert graph in such a way.

    Note that if (resulting) graph has property than all paths between given vertices (s and d) have same cost, than that property holds for each pair of vertices that lay on any path between s and d. That is seen by checking costs between s (or d) and any inner vertex x. With that we can say that each vertex x has cost from s.

    To create vertex costs:

    To create graph with required property change edge cost in a way that edge a -> b have cost cost_of_Vertex_b - cost_of_vertex_a.

    To get predefined cost, scale all costs by a factor.