Skip to main content

Finite Graph Algorithms

  • Chapter
  • First Online:
Practical Analysis of Algorithms

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 4202 Accesses

Abstract

This chapter introduces a variety of classical finite graph algorithms, such as are taught in upper level computer science classes, together with an analysis of their complexity. It starts with the formal definition and classification of graphs. Then it discussed implementation details and a C++ graph class example. Breadth-first and depth-first traversals are discussed and an application to counting the connected components of a graph is provided. Then Dijkstra’s algorithm is introduced, followed by Kruskal’s and Prim’s. The problems of topological sorting and maximum flow are discussed. Finally, special tours such as Hamiltonian are discussed, as well as their feasibility.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The word vertices is the plural of the noun vertex.

  2. 2.

    Note The prefix a- on words of Greek origin often means something like “without”: amoral (without morals), asymmetric (lacking symmetry), amorphous (formless), atheistic (godless), arrhythmic (out of rhythm).

  3. 3.

    An equivalence relation on a non-empty set \(S\) is a set, say \(R\), of ordered pairs of elements of \(S\), with the following properties for \(R\):

    1. (a)

      (reflexivity) for every \(x\) in \(S\) the pair \((x,\;x)\) belongs to \(R\);

    2. (b)

      (symmetry) for every \(x\) and \(y\) in \(S\), if \((x,\;y) \in R\), then \((y,\;x) \in R\);

    3. (c)

      (transitivity) for every \(x\), \(y\), and \(z\) in \(S\), if \((x,\;y) \in R\) and \((y,\;z) \in R\), then (\(x,\;z) \in R\).

      Suppose \(R\) is an equivalence relation on a set \(S\). Then it is customary to write \(xRy\) in place of \((x,\;y) \in R\). For each \(x\) in \(S\) the set \(\{y \in S \, {:} \, yRx\}\) is called the equivalence class of x and is denoted by [\(x\)]. Using properties (a), (b), (c) above, it is easy to prove the following assertions for all \(x\) and \(y\) in \(S\):

    4. (d)

      \(x \in \) [\(x\)];

    5. (e)

      if \(x \in \) [\(y\)], then \(y \in \) [\(x\)];

    6. (f)

      if [\(x\)] \(\cap \) [\(y\)] is non-empty, then [\(x\)] = [\(y\)].

      Here is one of the most important theorems about equivalence relations:

    If \(R\) is an equivalence relation on a non-empty set \(S\), then the set of all equivalence classes of the elements of \(S\) forms a partition of \(S\) into disjoint non-empty subsets of \(S\).

    The proof follows fairly quickly from assertions (d),(e), and (f) above.

  4. 4.

    “Iso-”, same; “morph”, form.

  5. 5.

    (DIKE-struh) In case you haven’t heard of him before, he became an object of heated controversy because of a letter he wrote in 1968 to the Communications of the ACM. The letter was printed under the title “Go To Statement Considered Harmful”. A goto instruction in a programming language is an instruction that allows execution to be directed from any place in a program to any other specified place (the place is specified by a label). In assembly languages the JUMP and BRANCH instructions are goto instructions. In languages such as old FORTRAN and old BASIC, the GOTO is indispensable for control-flow. Dijkstra argued that availability of a goto instruction in high level languages was bad because it encouraged promiscuous transfers of execution that made programs hard to read and debug. He and several colleagues proved that in languages that include the now familiar control-flow instructions such as “if... else....” and “while”, no goto statement is logically necessary. Dijkstra’s letter generated a storm of letters arguing for and against the proposal he had made. Today most high level languages still have the goto instruction available, but programmers are strongly discouraged from ever using this instruction, since it creates “unstructured” code.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Dana Vrajitoru .

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Vrajitoru, D., Knight, W. (2014). Finite Graph Algorithms. In: Practical Analysis of Algorithms. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-09888-3_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-09888-3_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-09887-6

  • Online ISBN: 978-3-319-09888-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics