Chapter 6 Graph theory

Graphs and Trees

Chapter 6.1 Graphs and representations
A (discrete) graph (informally) is a set of points and a set of paths between them

Formal Definition
A graph is a triple (N, A, g) where
 * N is a nonempty set of nodes or verticies
 * A is a set of arcs (can be an empty set)
 * g is a function which associates each arc with an unordered pair x-y of notes from N

Directed Graphs


Directed graphs have ordered pairs instead of unordered pairs for A


 * N is a nonempty set of nodes or verticies
 * A is a set of arcs (can be an empty set)
 * g: A → N x N (cartesian product) is a function which associates each arc with an ordered pair x-y of notes from N, x is the initial point and y is the terminal point

Terminology

 * Adjacent: two points are adjacent if they are connected by an arc. This applies equally in either a directed or undirected arc
 * A loop is an arc with endpoints n-n (or (n,n))
 * A graph with no loops is loop-free
 * A node is isolated if it is not adjacent to any other node
 * Arcs are parallel if they have the same endpoint. Can happen with both being directionless, both being in the same direction, or both going in different directions
 * An arc is simple if it is loop free and contains no parallel arcs
 * The degree of a node is the number of times it appears as the endpoint of an arc
 * If a node is connected to itself in a loop that means that it increases its degree by two, one for each time.
 * A path from node n0 to node nk is asequence of arcs and nodes
 * The length of a path is the number of arcs it contains
 * A graph is connected if there is a path between any two nodes
 * a cycle is a path from n0 to n0 where no arc appears more than once and no node appears more than once except n0
 * Needs to happen only twice, a cycle can't have n0 go through a bunch of things to itself and then back to itself in a different path That would be two cycles
 * A graph is acyclic if there are no possible cycles in the graph