Advanced Programming I Lecture Notes

Advanced Programming I Lecture Notes

23 March 2006 • Graph Algorithms


Outline

Connectedness

Connected Graphs

Connectedness Algorithm

Articulation Points

Biconnectedness

Depth-First Searching

A Biconnectedness Algorithm

Spanning Trees

A Spanning-Tree Algorithm

Traversal Costs

Minimum Spanning Trees

Finding MSTs

An MST Algorithm

graph mst(graph g)
  graph mst
  min-queue minq
  vertex v = g.vertices().pick()
  for n in g.neighbors(v)
    minq.enq((v, n), g.weight(v, n))
  while not minq.empty()
    e = minq.deq()
    mst.add_edge(e)
    for n in g.neighbors(e.second())
      if not n mst.vertices().member(n)
        minq.enq((v, n), g.weight(v, n))
  return msg

MST Algorithm Properties

Path Weights

Finding Minimum Paths

A Minimum-Path Algorithm

min-path(graph g, vertex v1) unsigned dist[g.vertices().size()] = { 0 } min-queue minq for n in g.neighbors(v1) dist[n] = g.weight(v1, n) minq.enq((v1, n), g.weight(v1, n)) while not minq.empty() e = minq.deq() v = e.second dist[v] = dist[e.first] + g.weight(e) for n in g.neighbors(v) if not n mst.vertices().member(n) minq.enq((v,n), dist[v] + g.weight(v,n))

Min-Path Properties

PERT Charts

Directed Acyclic Graphs

Scheduling PERT Tasks

  • Depth-first search backtracks more coherently then does breath-first search.

    PERT-Schedule Algorithm

    Exploiting Independence

    Edge And Vertex Terms

    Producing Better Schedules

    Example Schedule

    Critical Paths

    Finding Critical Paths


    This page last modified on 29 March 2006.

    This work is covered by a
    Creative Commons License.