I am working on a problem that I have generalised to what I have described in the title. Essentially I have a DAG that will look something like this: (I know it doesn’t matter what the DAG looks like I just thought it might show where I am at). I’ve drawn the vertex values as the edge distance (or cost)
Tag: graph-algorithm
Add new edge to Graph and check if total weight is reduced
I’m new to Graphs and I’m trying to solve this problem in Java: Given a Graph with N nodes and N-1 weighted bidirectional edges, the algorithm must respond YES if a new edge ‘q’ allows to reduce the overall weight of the graph, NO otherwise. The edge ‘q’ satisfies this condition if there is an edge ‘e’ such that it