Question about Dynamic programming-Shortest Path Problem

  • Context: MHB 
  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    Dynamic Path
Click For Summary

Discussion Overview

The discussion revolves around formulating a clustering problem as a shortest path problem in graph theory. Participants explore how to represent a set of items with associated costs for clustering them, and whether a shortest path algorithm is appropriate for this context.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants suggest that the problem should be represented as a directed weighted graph with vertices and edges corresponding to clusters and their costs.
  • Others question whether a shortest path algorithm is suitable, proposing that a minimal spanning tree might be more appropriate.
  • A participant proposes constructing a directed graph where vertices represent items and edges represent costs between clusters, suggesting that the minimum grouping cost corresponds to the shortest distance between specific vertices.
  • There is discussion about the specific weights assigned to edges, with some participants clarifying that the weight for an edge from vertex $i$ to $j$ is $c_{ij-1}$ rather than $c_{ij}$.
  • Participants express confusion about the relationship between the clustering problem and the shortest path problem, seeking clarification and examples.
  • One participant emphasizes the need to establish a bijection between partitions and paths in the graph to demonstrate the connection between costs and lengths.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether the shortest path algorithm is the correct approach for the problem, with multiple competing views on the appropriate method to represent the clustering problem.

Contextual Notes

There are unresolved questions regarding the definitions of costs and the representation of vertices in the graph, as well as the assumptions underlying the proposed models.

mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Given a set of n things (1,2,...,n), we want to group them in clusters that contain adjacent things. For each cluster there is a cost $c_{ij}$. We are looking for the grouping in clusters so that the total cost is minimal.
I am asked to write this problem as a shortest path problem.
What do I have to do?
Do I have to draw a directed weighted graph?
Since the problem is general, do I have to draw the first vertex, the last vertex, and some between them for example the vertex $i$ and $j$,and at the edge from $i$ to $j$ there is a cost $c_{ij}$??
 
Mathematics news on Phys.org
mathmari said:
Given a set of n things (1,2,...,n), we want to group them in clusters that contain adjacent things. For each cluster there is a cost $c_{ij}$. We are looking for the grouping in clusters so that the total cost is minimal.
I am asked to write this problem as a shortest path problem.
What do I have to do?
Do I have to draw a directed weighted graph?
Since the problem is general, do I have to draw the first vertex, the last vertex, and some between them for example the vertex $i$ and $j$,and at the edge from $i$ to $j$ there is a cost $c_{ij}$??

Things? What kind of things?
Marbles?
That's important!

Hmm, are you sure you're supposed to use a shortest path algorithm?
Seems to me it should be a minimal spanning tree (or forest).
I think that for a general problem you would need to specify an algorithm.
 
I like Serena said:
Things? What kind of things?
Marbles?
That's important!

Hmm, are you sure you're supposed to use a shortest path algorithm?
Seems to me it should be a minimal spanning tree (or forest).
I think that for a general problem you would need to specify an algorithm.

At the first subquestion I have to write the problem as a shortest path problem, at the second subquestion I have to specify an algorithm, and at the third I have to apply this algorithm in a specific problem.

We could consider the problem as a system of nodes (0,...,n) and curves $ \text arc(i,j)$ with $j>i$. Each $ \text arc(i,j)$ with $i<n$ corresponds to a cluster of edges $i+1,i+2,...,j$, whose cost is $c_{ij}$, while $ \text arc(n,n)$ has cost $0$.
 
Last edited by a moderator:
What is meant by writing the problem as a shortest path problem?
 
Last edited by a moderator:
To understand the exericse, to find the grouping so that the total cost is minimal, do I have to find the shortest path? Or how can I find it? :confused: Could you give me an example because I'm really confused..
 
The problem statement for the shortest path problem is finding a path between two vertices (or nodes) in a graph such that the sum of the weights of its constituent edges is minimized.

In my opinion that really does not apply to your problem.
So I think it may be a typo.
 
mathmari said:
Given a set of n things (1,2,...,n), we want to group them in clusters that contain adjacent things. For each cluster there is a cost $c_{ij}$. We are looking for the grouping in clusters so that the total cost is minimal.
I am asked to write this problem as a shortest path problem.
I assume $i$ and $j$ in $c_{ij}$ are indices of the first and last objects in a cluster; thus there is a $c_{ij}$ for each $1\le i\le j\le n$.

I suggest checking if the following idea works. Given a grouping problem, we construct a directed graph. The vertices are $1,\dots,n+1$. There is an edge from $i$ to $j$ iff $i<j$, and its weight is $c_{ij-1}$. Then the minimum grouping cost is the shortest distance between 1 and $n+1$.
 
Evgeny.Makarov said:
I assume $i$ and $j$ in $c_{ij}$ are indices of the first and last objects in a cluster; thus there is a $c_{ij}$ for each $1\le i\le j\le n$.

I suggest checking if the following idea works. Given a grouping problem, we construct a directed graph. The vertices are $1,\dots,n+1$. There is an edge from $i$ to $j$ iff $i<j$, and its weight is $c_{ij-1}$. Then the minimum grouping cost is the shortest distance between 1 and $n+1$.

Could you explain me why the weight for the edge from $i$ to $j$ iff $i<j$ is $c_{ij-1}$ ?
And also, why are the vertices denoted till $n+1$ ?
 
Last edited by a moderator:
mathmari said:
Could you explain me why the weight for the edge from $i$ to $j$ iff $i<j$ is $c_{ij-1}$ ?
Are you wondering why the edge from $i$ to $j$ corresponds to $c_{ij-1}$ as opposed to $c_{ij}$? For one, a segment consisting of one object #$i$ makes sense and has a cost $c_{ii}$. On the other hand, a loop is never a part of the shortest path.

mathmari said:
And also, why are the vertices denoted till $n+1$ ?
If you need to employ $c_{in}$ and, according to the reasoning above, the second index is the result of subtracting 1, then the last vertex should be $n+1$.

For each partitioning problem you get a direct graph. You should prove that there is a bijection between partitions and paths from 1 to $n+1$, and it maps cost to length. Then minimal length would correspond to minimal cost.
 
  • #10
Evgeny.Makarov said:
Are you wondering why the edge from $i$ to $j$ corresponds to $c_{ij-1}$ as opposed to $c_{ij}$? For one, a segment consisting of one object #$i$ makes sense and has a cost $c_{ii}$. On the other hand, a loop is never a part of the shortest path.

If you need to employ $c_{in}$ and, according to the reasoning above, the second index is the result of subtracting 1, then the last vertex should be $n+1$.

For each partitioning problem you get a direct graph. You should prove that there is a bijection between partitions and paths from 1 to $n+1$, and it maps cost to length. Then minimal length would correspond to minimal cost.

For example for n=5, is the graph the following?

View attachment 1793
 

Attachments

  • dir_gr.png
    dir_gr.png
    12.9 KB · Views: 140
  • #11
Evgeny.Makarov said:
You should prove that there is a bijection between partitions and paths from 1 to $n+1$, and it maps cost to length.

Could you give me a hint how to do this? I have not really understood the relation between the grouping problem and the shortest path problem.. :confused:
 
  • #12
mathmari said:
For example for n=5, is the graph the following?
Yes.
 
  • #13
mathmari said:
Could you give me a hint how to do this? I have not really understood the relation between the grouping problem and the shortest path problem.. :confused:

I got it now...your answers were helpful!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K