Definitions

Types of Graphs

Trajectories and Circuits Probabilistic Graphical Models

Graph Isomorphism L. Enrique Sucar, INAOE Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 1 / 32 Outline

Definitions 1 Definitions Types of Graphs 2 Types of Graphs Trajectories and Circuits

Graph 3 Trajectories and Circuits Isomorphism Trees 4 Graph Isomorphism Cliques

Perfect 5 Trees Ordering Ordering and 6 Cliques Triangulation Algorithms

References 7 Perfect Ordering

8 Ordering and Triangulation Algorithms

9 References

(INAOE) 2 / 32 Definitions Graphs

Definitions Types of • A graph provides a compact way to represent binary Graphs relations between a set of objects Trajectories and Circuits • Objects are represented as circles or ovals, and Graph Isomorphism relations as lines or arrows Trees • There are two basic types of graphs: undirected graphs Cliques and directed graphs Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 3 / 32 Definitions Directed Graphs

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism • A or digraph is an ordered pair, Trees G = (V , E), where V is a set of vertices or nodes and E Cliques is a set of arcs that represent a binary relation on V Perfect Ordering • Directed graphs represent anti-symmetric relations

Ordering and between objects, for instance the “parent” relation Triangulation Algorithms

References

(INAOE) 4 / 32 Definitions Undirected Graphs

Definitions

Types of Graphs

Trajectories and Circuits Graph • An undirected graph is an ordered pair, G = (V , E), Isomorphism where V is a set of vertices or nodes and E is a set of Trees edges that represent symmetric binary relations: Cliques

Perfect (Vj , Vk ) ∈ E → (Vk , Vj ) ∈ E Ordering • Undirected graphs represent symmetric relations Ordering and Triangulation between objects, for example, the “brother” relation Algorithms

References

(INAOE) 5 / 32 Definitions More Definitions

Definitions

Types of Graphs Trajectories • If there is an edge Ei (Vj , Vk ) between nodes j and k, and Circuits then Vj is adjacent to Vk Graph Isomorphism • The degree of a node is the number of edges that are Trees incident in that node Cliques • Two edges associated to the same pair of vertices are Perfect Ordering said to be parallel edges Ordering and Triangulation Algorithms

References

(INAOE) 6 / 32 Definitions More Definitions

Definitions

Types of Graphs

Trajectories and Circuits

Graph • A vertex that is not an endpoint to any edge is an Isomorphism isolated vertex –it has degree 0 Trees • In a directed graph, the number of arcs pointing to a Cliques

Perfect node is its in degree Ordering • The number of edges pointing away from a node is its Ordering and Triangulation out degree Algorithms

References

(INAOE) 7 / 32 Types of Graphs Types of Graphs (I)

Definitions Chain graph: a hybrid graph that has directed and Types of undirected edges. Graphs Simple graph: a graph that does not include cycles and Trajectories and Circuits parallel arcs. Graph Multigraph: a graph with several components (subgraphs), Isomorphism

Trees such that each component has no edges to the

Cliques other components, i.e., they are disconnected.

Perfect Complete graph: a graph that has an edge between each Ordering pair of vertices. Ordering and Triangulation Bipartite graph: a graph in which the vertices are divided in Algorithms two subsets, G1, G2, such that all edges References connect a vertex in G1 with a vertex in G2; that is, there are no edges between nodes in each subset. Weighted graph: a graph that has weights associated to its edges and/or vertices.

(INAOE) 8 / 32 Types of Graphs Types of Graphs (II)

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 9 / 32 Trajectories and Circuits Trajectories

Definitions Types of • A trajectory is a sequence of edges, E , E , ..., E such Graphs 1 2 n

Trajectories that the final vertex of each edge coincides with the and Circuits initial vertex of the next edge in the sequence Graph Isomorphism • A simple trajectory does not include the same edge two Trees o more times; an elemental trajectory is not incident on Cliques the same vertex more than once Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 10 / 32 Trajectories and Circuits Circuits

Definitions • A circuit is a trajectory such that the final vertex Types of coincides with the initial one Graphs

Trajectories • A simple circuit does not include the same edge two or and Circuits more times; an elemental circuit is not incident on the Graph Isomorphism same vertex more than once (except the initial/final Trees vertex) Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 11 / 32 Trajectories and Circuits Directed Acyclic Graphs

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees • A DAG is a directed graph that has no directed circuits Cliques (a directed circuit is a circuit in which all edges in the Perfect sequence follow the directions of the arrows) Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 12 / 32 Trajectories and Circuits Problems

Definitions • Finding a trajectory that includes all edges in a graph Types of Graphs only once (Euler trajectory). Trajectories and Circuits • Finding a circuit that includes all edges in a graph only Graph once (Euler circuit). Isomorphism

Trees • Finding a trajectory that includes all vertices in a graph

Cliques only once (Hamiltonian trajectory). Perfect • Ordering Finding a circuit that includes all vertices in a graph only

Ordering and once (Hamiltonian circuit). Triangulation Algorithms • Finding a Hamiltonian circuit in a weighted graph with 1 References minimum cost (Traveling salesman problem) .

1In this case the nodes represent cities and the edges roads with an associated distance or time, so the solution will provide a traveling salesman with the “best” (minimum distance or time) route to cover all the cities. (INAOE) 13 / 32 Graph Isomorphism Isomorphism (I)

Definitions

Types of Graphs

Trajectories and Circuits • Two graphs are isomorphic if there is a one to one Graph correspondence between their vertices and edges, so Isomorphism that the incidences are maintained Trees

Cliques • Types: Perfect 1 Graph isomorphism. Graphs G1 and G2 are isomorphic. Ordering 2 Subgraph isomorphism. Graph G1 is isomorphic to a Ordering and Triangulation subgraph of G2 (or vice versa). Algorithms 3 Double subgraph isomorphism. A subgraph of G1 is References isomorphic to a subgraph of G2.

(INAOE) 14 / 32 Graph Isomorphism Isomorphism (II)

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References • Determining if two graphs are isomorphic (type 1) is an NP problem; while the subgraph and double subgraph isomorphism problems (type 2 and 3) are NP-complete

(INAOE) 15 / 32 Trees Undirected trees

Definitions • An undirected is a connected graph that does not Types of Graphs have simple circuits Trajectories and Circuits • There are two classes of vertices or nodes in an

Graph undirected tree: (i) leaf or terminal nodes, with degree Isomorphism one; (ii) internal nodes, with degree greater than one Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 16 / 32 Trees Properties

Definitions

Types of Graphs

Trajectories and Circuits Graph • There is a simple trajectory between each pair of Isomorphism vertices. Trees

Cliques • The number of vertices, | V |, is equal to the number of Perfect edges, | E | plus one: | V |=| E | +1. Ordering • Ordering and A tree with two or more vertices has at least two leaf Triangulation Algorithms nodes.

References

(INAOE) 17 / 32 Trees Directed trees • A directed tree is a connected directed graph such that Definitions

Types of there is only a single directed trajectory between each Graphs pair of nodes Trajectories and Circuits • A rooted tree has a single node with an in degree of

Graph zero (the root node) and the rest have in degree of one Isomorphism • A polytree might have more than one node with in Trees degree zero (roots), and certain nodes (zero or more) Cliques with in degree greater than one Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 18 / 32 Trees Terminology (I)

Definitions Root: a node with in degree equal to zero. Types of Leaf: a node with out degree equal to zero. Graphs Internal node: a node with out degree greater than zero. Trajectories and Circuits Parent / Child: if there is a directed arc from A to B, A is Graph parent of B and B is a child of A. Isomorphism

Trees Brothers: two or more nodes that have the same parent.

Cliques Ascendants /Descendants: if there is a directed trajectory

Perfect from A to B, A is an ascendant of B and B is a Ordering descendant of A. Ordering and Triangulation Subtree with root A: a subtree with A as its root. Algorithms Subtree of A: a subtree with a child of A as its root. References K-ary Tree: a tree in which each internal node has at most K children. It is a regular tree if each internal node has K children. Binary Tree: a tree in which each internal node has at most two children. (INAOE) 19 / 32 Trees Terminology (II)

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 20 / 32 Cliques Complete set and subsets

Definitions

Types of Graphs

Trajectories and Circuits Graph • A complete graph is a graph, Gc, in which each pair of Isomorphism nodes is adjacent; that is, there is an edge between Trees each pair of nodes Cliques Perfect • A complete set, Wc is a subset of G that induces a Ordering complete subgraph of G. It is a subset of vertices of G Ordering and Triangulation so that each pair of nodes in this subgraph is adjacent Algorithms

References

(INAOE) 21 / 32 Cliques Cliques

Definitions Types of • A clique, C, is a subset of graph G such that it is a Graphs

Trajectories complete set that is maximal; that is, there is no other and Circuits complete set in G that contains C Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 22 / 32 Perfect Ordering Ordering

Definitions

Types of Graphs Trajectories • An ordering of the nodes in a graph consists in and Circuits

Graph assigning an integer to each vertex Isomorphism • Given a graph G = (V , E), with n vertices, then Trees α = [V1, V2, ..., Vn] is an ordering of the graph; V is Cliques i before V according to this ordering, if i < j Perfect j Ordering • An ordering α of a graph G = (V , E) is a perfect Ordering and Triangulation ordering if all the adjacent vertices of each vertex Vi Algorithms that are before Vi , according to this ordering, are References completely connected

(INAOE) 23 / 32 Perfect Ordering Perfect Ordering

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 24 / 32 Perfect Ordering Clique Ordering

Definitions

Types of Graphs

Trajectories and Circuits • In an analogous way as an ordering of the nodes, we Graph can define an ordering of the cliques, Isomorphism β = [ , , ..., ] Trees C1 C2 Cp Cliques • An ordering β of the cliques has the running intersection Perfect property, if all the common nodes of each clique Ci with Ordering previous cliques according to this order are contained in Ordering and Triangulation a clique C ; C is the parent of C Algorithms j j i

References • It is possible that a clique has more than one parent

(INAOE) 25 / 32 Perfect Ordering Triangulated graphs

Definitions • A graph G is triangulated if every simple circuit of length Types of greater than three in G has a chord Graphs • A chord is an edge that connects two of the vertices in Trajectories and Circuits the circuit and that is not part of that circuit Graph • Isomorphism A condition for achieving a perfect ordering of the

Trees vertices, and having an ordering of the cliques that

Cliques satisfies the running intersection property, is that the Perfect graph is triangulated Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 26 / 32 Ordering and Triangulation Algorithms Maximum Cardinality Search

Definitions

Types of Graphs

Trajectories and Circuits • Given that a graph is triangulated, the following Graph algorithm guarantees a perfect ordering: Isomorphism

Trees 1 Select any vertex from V and assign it number 1. Cliques

Perfect 2 WHILE Not all vertices in G have been numbered: Ordering 1 From all the non-labeled vertices, select the one with Ordering and Triangulation higher number of adjacent labeled vertices and assign it Algorithms the next number. References 2 Break ties arbitrarily.

(INAOE) 27 / 32 Ordering and Triangulation Algorithms Example

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 28 / 32 Ordering and Triangulation Algorithms Graph filling

Definitions

Types of Graphs Trajectories • The filling of a graph consists of adding arcs to an and Circuits original graph G to make it triangulated Graph Isomorphism • The following algorithm makes the graph triangulated: Trees

Cliques 1 Order the vertices V with maximum cardinality search: Perfect Ordering V1, V2, ..., Vn. Ordering and 2 FOR i = n TO i = 1 Triangulation Algorithms 1 For node Vi , select all its adjacent nodes Vj such that References j > i. Call this set of nodes Ai . 2 Add an arc from Vi to Vk if k > i and Vk ∈/ Ai .

(INAOE) 29 / 32 Ordering and Triangulation Algorithms Example

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism

Trees

Cliques

Perfect Ordering

Ordering and Triangulation Algorithms A5: ∅ References A4:5 A3:4 , 5 A2:3 , 5. An arc is added from 2 to 4. A1:2 , 3, 4. An arc is added from 1 to 5. The resulting graph has two additional arcs 2 − 4 and 1 − 5

(INAOE) 30 / 32 References Book

Definitions

Types of Graphs

Trajectories and Circuits

Graph Isomorphism Trees Sucar, L. E, Probabilistic Graphical Models, Springer 2015 – Cliques Chapter 3 Perfect Ordering

Ordering and Triangulation Algorithms

References

(INAOE) 31 / 32 References Additional Reading

Definitions

Types of Aho, A.V., Hopcroft, J.E, Ullman, J.D.: The Design and Graphs Analysis of Computer Algorithms. Addison-Wesley, Trajectories and Circuits Boston (1974) Graph Isomorphism Golumbic, M.C.: Algorithmic Graph Theory and Perfect Trees Graphs. Elsevier, Netherlands (1994) Cliques

Perfect Gould, R.: Graph Theory. Benjamin/Cummings, Menlo Ordering Park (1988) Ordering and Triangulation Algorithms Gross, J.L, Yellen, J.: Graph Theory and its Applications.

References CRC Press, Boca Raton (2005) Neapolitan, R.: Probabilistic Reasoning in Expert Systems: Theory and Algorithms. Wiley, New York (1990)

(INAOE) 32 / 32