250 likes | 258 Views
Vertices and Edges. Introduction to Graphs and Networks Mills College Spring 2012. Today’s Topics. Introduce concepts and jargon Basics of graph theory Different ways to represent networks/graphs. Graphs, vertices, edges .
E N D
Vertices and Edges Introduction to Graphs and Networks Mills College Spring 2012
Today’s Topics • Introduce concepts and jargon • Basics of graph theory • Different ways to represent networks/graphs
Graphs, vertices, edges. • The math of networks follows from the full matrix format we introduced above. That format is, in fact, what we call the adjacency matrix. • Adjacency matrix. • Incidence matrix • Notation and conventions. • Directed and undirected networks. • Distance or Path matrix
Network = {vertices}, {edges} • A network is an entity containing two sets: • Set of vertices, • e.g., {A, B, C} • Set of edges where edges are pairs of vertices • e.g., {(A,B), (A,C)} B (A,B) A C (A,C)
Tabular (Matrix) Representation B (A,B) A C (A,C)
Exercise 1 • Sketch the network {a, b, c, d} {(a,b), (a,c), (a,d), (b,d), (c,d)} • Express this network in table/matrix form c a d b
Exercise 2 • Express this network in table/matrix form e c a d b
Self-edges and Multi-Edges • An edge that connects a vertex to itself is a self-edge. • If there is more than one edge between a pair of vertices we call it a multi-edge
Exercise 3 • How do you think this would be represented in matrix form? c a d b
Degree The degree of a vertex is the number of edges connected to it. 2 0 f e 2 3 c a 3 d b 4
Directed and Undirected Graphs • Edges can have direction – from vertex A to vertex B • Edges are then represented as ORDERED pair (a,b) but not (b,a) • A directed graph is also called a digraph X a b
Exercise 4 • Sketch the digraph represented by this matrix a b d c
In- and Out-degree in Digraphs • For vertices in a digraph we distinguish IN-degree (number of edges coming in) from OUT-degree (number going out) Degreein = 2 Degreeout = 2 Degreein = 1 Degreeout = 2 a b Degreein = 1 Degreeout = 3 Degreein = 3 Degreeout = 0 d c
Exercise : Density • Describe the difference between these three 5 vertex networks
Exercise • The network on the left is “maximally connected.” It has a total of 6 edges and each vertex has degree 3. • For network on right, calculate (a) ratio of # edges to possible # of edges, (b) for each vertex, ratio of its degree to maximum possible degree. a a b b d d c c
Planar Networks • If a network can be drawn on a flat piece of paper without any edges crossing it is called a planar network.
Exercise: Is this network planar? e c a c a d b d b e
Paths • If there is an edge between two nodes, A and B, we say there is a path from A to B. If there is a sequence of paths from A to B to C, then we say there is a path from A to C • Path length is number of edges on the path.
Geodesic & Diameter • Shortest path between 2vertices is a geodesic • Longest path in a graph is its diameter. a b Geodesic between a and d is a-c-d of length 2 Diameter of graph is 4 c e d
Connected Graphs • In a connected graph there is a path from any given vertex to any other given vertex. • A directed graph is strongly connected when there is a directed path from any given vertex to any other. • It is weakly connected if it is only connected when you treat the edges as undirected.
Fully Connected • A fully connected graph is one that has all the possible edges • It is also called a clique or k-clique (Kn). a a b d c K2 K3 K4 K5 a a a b b b d c c
Counting Paths • How many paths from a to f? • How many paths from a to f? a f e ONE b c d a f e TWO b c d
Exercise Counting Paths • How many paths from a to f? • What is the shortest path from a to f? • What is the longest path in this graph? FOUR a f e 2 paths A-C times 2 paths D-F = 4 paths A-F b c d