Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

42
Graph s & Matrice s Todd Cromedy & Bruce Nicometo March 30, 2004

Transcript of Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Page 1: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Graphs &Matrices

Todd Cromedy & Bruce Nicometo

March 30, 2004

Page 2: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

GraphsGraphs

Graph Theory provides vocabulary which can be used to label and denote many social Graph Theory provides vocabulary which can be used to label and denote many social structural properties.structural properties.

Graph Theory gives us mathematical operations and ideas with which many of these Graph Theory gives us mathematical operations and ideas with which many of these properties can be quantified and measured (see Freeman 1984; Seidman and Foster 1987b).properties can be quantified and measured (see Freeman 1984; Seidman and Foster 1987b).

Graph Theory gives us representation of a social network as a model of a social systemGraph Theory gives us representation of a social network as a model of a social system consisting of a set of actors and the ties between them.consisting of a set of actors and the ties between them.

Page 3: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Graph Types

Relational

Non-directional (simple to complex)

Directed (simple to complex)

Signed and Valued

Hypergraphs

Page 4: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

ModelModel By model we mean a simplified representation By model we mean a simplified representation

of a situation that contains some, but not all, of of a situation that contains some, but not all, of the elements of the situation it represents the elements of the situation it represents (Roberts 1976; Hage and Harary 1983).(Roberts 1976; Hage and Harary 1983).

In this sense, a graph is a model of a social In this sense, a graph is a model of a social network in the same way that a model train set network in the same way that a model train set is a model of a railway system.is a model of a railway system.

Graphs have been used in social networks as a Graphs have been used in social networks as a means of formally representing social relations means of formally representing social relations and quantifying structural propertiesand quantifying structural properties

Page 5: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Matrices

Matrices are alternative ways to represent and summarize network data.

A matrix contains exactly the same information as a graph.

A matrix is more useful for computation and computer analysis.

Page 6: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Some Graph Characteristics

In a graph of a social network with single nondirectional dichotomous relation, the nodes (n) represent actors, and the lines (L) represent the ties that exist between pairs of actors.

The tie is either present of absent between each pair of actors.

Nondirectional relations include:

Co-memberships in formal and informal groups or orgs

Some kinship relations: “is married to” “lives near”

Interactions― “works with”

Page 7: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

More CharacteristicsA graph consists of two sets of information:

The set of N = {n1,n2 … ng}, and

The set of L = {l1, l2 … lL} between pairs of nodes.

There are g nodes and L lines.

In a graph each line is an unordered pair of distinct nodes, lk = (ni, nj).

Page 8: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

ExampleExample Here we take six nodes to represent six Here we take six nodes to represent six

children.children.

A line between two nodes indicates that A line between two nodes indicates that the children represented by these nodes the children represented by these nodes “live near” each other.“live near” each other.

For example, Sarah and Allison, live near For example, Sarah and Allison, live near each other so the line is included in the each other so the line is included in the set of lines. set of lines.

Allison and Elliot do not live near each Allison and Elliot do not live near each other, so the line is not in the set of lines.other, so the line is not in the set of lines.

Page 9: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Actor Lives near

n1 Allison Ross, Sarah

n2 Eliot Drew

n3 Drew Eliot

n4 Keith Ross, Sarah

n5 Ross Allison, Keith, Sarah

n6 Sarah Allison, Keith, Ross

n1 Allison

n2 Drew

n3 Eliot

n6 Sarah

n5 Rossn4 Keith

l2

l1

l5

l4

l6

l3

Page 10: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Line Characteristics

Adjacent or Incident

Two nodes are adjacent if line lk =(n1,n2)

A node is incident within a line, and the line with the node

if the node is one of the unordered pair of nodes defining

the line.

Page 11: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Social Networks

Social networks can be studied at different levels.

Actors

Dyads

Triad

Subgroup

Whole Group

Page 12: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Dyads and TriadsDyads and Triads

A dyad, representing a pair of actors A dyad, representing a pair of actors and the possible tie between them, is and the possible tie between them, is a (node-generated) subgraph a (node-generated) subgraph consisting of a pair of nodes and the consisting of a pair of nodes and the possible line between the nodes.possible line between the nodes.

Triadic analysis is also based on Triadic analysis is also based on subgraphs, where the number of subgraphs, where the number of nodes is three. A triad is a subgraph nodes is three. A triad is a subgraph consisting of three nodes and the consisting of three nodes and the possible lines among them.possible lines among them.

Page 13: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Nodal DegreeNodal Degree The degree of a node is the number of lines that are The degree of a node is the number of lines that are

incident with it.incident with it.

Degrees are very easy to compute, and yet can be Degrees are very easy to compute, and yet can be quite informative in many applications.quite informative in many applications.

For example, if we observe children playing together, For example, if we observe children playing together, and represent children by nodes, and instances of pairs and represent children by nodes, and instances of pairs of children playing by lines in a graph, then a node with of children playing by lines in a graph, then a node with a small degree would indicate a child who played few a small degree would indicate a child who played few with others, and a node with a large degree would with others, and a node with a large degree would indicate a child who played with may others.indicate a child who played with may others.

Page 14: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Nodal Degree

d(n1) =2

d(n2) =1

d(n3) =1

d(n4) =2

d(n5) =3

d(n6) =3

n1 Allison

n2 Drew

n3 Eliot

n6 Sarah

n5 Rossn4 Keith

l2

l1

l5

l4

l6

l3

Page 15: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Other LinksBesides ties there are other means to consider the way in which two nodes can be linked by “indirect” routes.

Walks- Walks- A walk is a sequence of nodes and lines, starting and A walk is a sequence of nodes and lines, starting and ending with nodes, in which each node is incident with the lines ending with nodes, in which each node is incident with the lines following and preceding it in the sequence.following and preceding it in the sequence.

If a line is included more than once in the walk, it is counted each If a line is included more than once in the walk, it is counted each time it occurstime it occurs..

W=n1l2 n4l3 n2l3 n4

n1n4

n2

l2

l3

The length of a walk is the number of occurrences of lines in it.The length of a walk is the number of occurrences of lines in it.

Page 16: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Trails- Trails- a walk in which all of the lines are distinct, a walk in which all of the lines are distinct, though some nodes may be included more than once.though some nodes may be included more than once.

W= n4l3 n2l4 n3l5 n4l2 n1

n4

n2

n3

l3l4

l5

n1

Page 17: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Paths- Paths- a walk in which all nodes and all lines are distinct.a walk in which all nodes and all lines are distinct.

W= n1l2 n4l3 n2

n1

l2l3

n2

For example, a path through a communication network mean no For example, a path through a communication network mean no actor is informed more than once. The length of a path is the actor is informed more than once. The length of a path is the number of lines in it.number of lines in it.

n4

Page 18: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Walks, Trail, PathsWalks, Trail, Paths

Notice that every path is a trail, and every trail is Notice that every path is a trail, and every trail is a walk.a walk.

So any pair of nodes connected by a path is also So any pair of nodes connected by a path is also connected by a trail and by a walk.connected by a trail and by a walk.

Thus, a walk is the most general and a path is the Thus, a walk is the most general and a path is the least general kind of “route” through a graph.least general kind of “route” through a graph.

Since all paths are walks (but without repeating Since all paths are walks (but without repeating nodes or lines) a path is likely to be shorter nodes or lines) a path is likely to be shorter compared to a walk or a trail.compared to a walk or a trail.

Page 19: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Closed Walks, Tours, and CyclesClosed Walks, Tours, and Cycles

Some walks begin and end at the same node. Some walks begin and end at the same node.

A walk that begins and ends with the same node A walk that begins and ends with the same node is called a closed walk.is called a closed walk.

A cycle is a closed walk of at least three nodes in A cycle is a closed walk of at least three nodes in which all lines are distinct , and all nodes except which all lines are distinct , and all nodes except the beginning and ending node are distinct.the beginning and ending node are distinct.

Cycles are important in the study of balance and Cycles are important in the study of balance and clusterability in signed graphs.clusterability in signed graphs.

A tour is a closed walk in which each line in the A tour is a closed walk in which each line in the graph is used at least once.graph is used at least once.

Page 20: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

GeodesicsGeodesics

A shorter path between two nodes is A shorter path between two nodes is referred to as a geodesic.referred to as a geodesic.

The geodesic distance or simply the The geodesic distance or simply the distance between two nodes is defined as distance between two nodes is defined as the length of a geodesic between them.the length of a geodesic between them.

The distance between two nodes is the The distance between two nodes is the length of any shortest path between them.length of any shortest path between them.

Page 21: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Connectivity of GraphsConnectivity of Graphs

The connectivity of a graph is a function The connectivity of a graph is a function of whether a graph remains connected of whether a graph remains connected when nodes and/or lines are deleted.when nodes and/or lines are deleted.

Two components of connectivity are cutpoints and bridges.

Page 22: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

CutpointsCutpoints A node, is a cutpoint if the number of A node, is a cutpoint if the number of

components in the graph contains less than the components in the graph contains less than the number of components in the subgraph.number of components in the subgraph.

In a communication network, an actor who is a In a communication network, an actor who is a cutpoint is critical, in the sense that if that actor cutpoint is critical, in the sense that if that actor is removed from the network, the remaining is removed from the network, the remaining network has two subsets of actors, between network has two subsets of actors, between whom no communication can travel.whom no communication can travel.

The concept of a cutpoint can be extended from The concept of a cutpoint can be extended from a single node to a set of nodes necessary to a single node to a set of nodes necessary to keep the graph connected.keep the graph connected.

Page 23: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

CutpointsCutpoints

Bridges are notion analogous to that of Bridges are notion analogous to that of cutpoint exists for lines.cutpoint exists for lines.

A bridge is a line that is critical to the A bridge is a line that is critical to the connectedness of the graph.connectedness of the graph.

A bridge is a line such that the graph A bridge is a line such that the graph containing the line has fewer components containing the line has fewer components than the subgraph that is obtained after than the subgraph that is obtained after the line is removed.the line is removed.

Page 24: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

n1

n2

n3

n4

n5

n7

n6

Example of a cutpoint in a graph

Page 25: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

n2

n3

n4

n5

n7

n6

Page 26: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Directed GraphsDirected Graphs

A relation is directional if the ties are A relation is directional if the ties are oriented from one actor to another.oriented from one actor to another.

The import/export of goods between The import/export of goods between nations is an example of a directional nations is an example of a directional relation.relation.

Choices of friendships are another Choices of friendships are another example of a directional relation.example of a directional relation.

Page 27: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Directed GraphsDirected Graphs

A directional relation can be represented A directional relation can be represented by a directed graph, or a diagraph for by a directed graph, or a diagraph for short. short.

A diagraph consists of a set of nodes & a A diagraph consists of a set of nodes & a set of arcs, representing directed ties set of arcs, representing directed ties between actors.between actors.

The differences between a graph and a The differences between a graph and a directed graph is that in a directed graph directed graph is that in a directed graph the direction of the lines are specified.the direction of the lines are specified.

Page 28: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

l1

l2l3

l5

l4

l8

l6

l7

n1

n2

n3

n4

n5

n6

ARCSTies between actors

Page 29: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Signed GraphsSigned Graphs

Occasionally relations are measured in Occasionally relations are measured in which the ties can be interpreted as being which the ties can be interpreted as being either positive or negative (valence), in either positive or negative (valence), in affect, evaluation, or meaning.affect, evaluation, or meaning.

For example, one might measure the For example, one might measure the relations “loves” and “hates” among the relations “loves” and “hates” among the people in a group, or the relations “is people in a group, or the relations “is allied with” and “is at war with” among allied with” and “is at war with” among countries.countries.

Page 30: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

-

-+

+

+

-

-

SIGNED GRAPH

Page 31: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

HypergraphsHypergraphs

Some social network applications consider Some social network applications consider ties among subsets of actors in a network, ties among subsets of actors in a network, such as the tie among people who belong such as the tie among people who belong to the same club or civic organization.to the same club or civic organization.

Such networks called affiliation networks, Such networks called affiliation networks, or membership networks require or membership networks require considering subsets of nodes in a graph, considering subsets of nodes in a graph, where these subsets can be any size.where these subsets can be any size.

Page 32: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

HypergraphsHypergraphs

A hypergraph, rather than a graph, is A hypergraph, rather than a graph, is the appropriate representation for the appropriate representation for affiliation network data.affiliation network data.

A hypergraph consists of a set of A hypergraph consists of a set of objects and a collection of subsets of objects and a collection of subsets of objects, in which each object belongs objects, in which each object belongs to at least one subset, and no subset to at least one subset, and no subset is empty.is empty.

Page 33: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

a2

a1

a3

a4

hypergraph

Page 34: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

HypergraphHypergraph

Hypergraphs are more general than graphs. Hypergraphs are more general than graphs.

A graph is a special case of a hypergraph in A graph is a special case of a hypergraph in which the number of points in each edge is which the number of points in each edge is exactly equal to two.exactly equal to two.

Any graph can be represented as a hypergraph, Any graph can be represented as a hypergraph, by letting the nodes in the graph be the points in by letting the nodes in the graph be the points in the hypergraph, and letting each line in the graph the hypergraph, and letting each line in the graph be an edge in the hypergraph.be an edge in the hypergraph.

Each edge thus contains exactly two points.Each edge thus contains exactly two points.

Page 35: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

matrices00010011010101

00101100110101

01101010001010

10101010101011

11110101101001

Page 36: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

The information in a graph may also be expressed in a matrix form

There are two type of matrices especially useful.

Sociomatrix (X) or adjacency matrix

Incidence (I) matrix

Page 37: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Matrix Characteristics

Sociomatrix

Size = g x g There is a row and a column for each node

The entries record which pairs of nodes are adjacent

Incidence

Size = g x L

Nodes index rowsLines index columns

Page 38: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Sociomatrix (X)

X

n1 n2 n3 n4 n5 n6

n1 - 0 0 0 1 1

n2 0 - 1 0 0 0

n3 0 1 - 0 0 0

n4 0 0 0 - 1 1

n5 1 0 0 1 - 1

n6 1 0 0 1 1 -

Page 39: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

n1 Allison

n2 Drew

n3 Eliot

n6 Sarah

n5 Rossn4 Keith

l2

l1

l5

l4

l6

l3

Page 40: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Incidence Matrix (I)

I

l1 l2 l3 l4 l5 l6

n1 1 1 0 0 0 0

n2 0 0 1 0 0 0

n3 0 0 1 0 0 0

n4 0 0 0 1 1 0

n5 1 0 0 1 0 1

n6 0 1 0 0 1 1

Page 41: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

Directed Matrix

X

n1 n2 n3 n4 n5 n6

n1 - 1 0 0 1 0

n2 0 - 1 0 0 1

n3 0 1 - 0 0 0

n4 0 0 0 - 1 0

n5 0 0 0 0 - 1

n6 0 1 0 0 0 -

Page 42: Graphs & Matrices Todd Cromedy & Bruce Nicometo March 30, 2004.

l1

l2l3

l5

l4

l8

l6

l7

n1

n2

n3

n4

n5

n6

ARCSTies between actors