Computer Algorithms II Lecture Notes

13 November 2008 • Graph Algorithms


Outline

Connectedness

Connected Graphs

Connectedness Algorithm

Articulation Points

Biconnectedness

Depth-First Searching

Recognizing Backedges

A Biconnectedness Algorithm

Spanning Trees

Spanning Tree Example

A Spanning-Tree Algorithm

Traversal Costs

Minimum Spanning Trees

Example Non-MST

Finding MSTs

An MST Algorithm

graph mst(graph g)

  min-queue minq
  graph mst
  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()
    v = e.second()
    if not mst.vertices().member(v)
      mst.add_edge(e)
      for n in g.neighbors(v)
	if not mst.vertices().member(n)
	  minq.enq((v, n), g.weight(v, n))

  return mst

Example MST

MST Algorithm Properties

Path Weights

Finding Minimum Paths

Modified PFS

A Minimum-Path Algorithm

min-path(graph g, vertex vs) unsigned dist[g.vertices().size()] = { ∞ } min-queue minq for n in g.neighbors(vs) dist[n] = g.weight(vs, n) minq.enq((vs, n), g.weight(vs, n)) while not minq.empty() e = minq.deq() v = e.second if dist[v] > dist[e.first] + g.weight(e) 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

Observations

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

    Summary


    This page last modified on 20 November 2008.

    Creative
    Commons License