Algorithms
Social Graphs
Algorithms
Social Graphs
Definition I: A social graph contains all the friendship
relations (edges) among a group of n people (vertices).
The friendship relationship is symmetric. Two vertices with
no edge between them are enemies.
Definition II: In a social graph with n vertices, all the(
n2
)
edges are colored either by blue (friends) or by red
(enemies).
Algorithms 1
Statement I
Theorem: There is no group of 7 people such that each
person in the group has exactly 3 friends in the group.
Proof:
⋆ The hand-shaking lemma: In any graph the sum of all
the degrees is even.
− Because each edge contributes exactly 2 to this sum.
⋆ The sum of all degrees in a graph with 7 vertices for
which all degrees are 3 is 21 which is odd.
− Therefore, such a graph is impossible.
Algorithms 2
Statement II
Theorem: In any group of n ≥ 2 people, there are at least 2
people with the same number of friends in the group.
Proof:
⋆ In a graph with n vertices, 0, 1, . . . , n − 1 are the only
possible values for a degree of a vertex.
⋆ If each vertex has a distinct degree, then there must be
a vertex v with degree d(v) = n − 1 and a vertex u with
degree d(u) = 0.
⋆ But d(v) = n− 1 implies that d(u) ≥ 1; a contradiction.
Algorithms 3
Statement III
Theorem: There exists a group of 5 people for which no 3
are mutual friends and no 3 are mutual enemies.
Proof: The following coloring of the edges of K5 with blue
or red is the only (up to a symmetry) coloring with no
uni-colored triangle.
Algorithms 4
Statement IV
Theorem: Every group of 6 people contains either three
mutual friends or three mutual enemies.
Proof:
⋆ Consider vertex A. A has either 3 friends or 3 enemies.
Assume B,C,D are 3 friends of A.
⋆ If any of the 3 pairs BC,CD,BD are friends, then this
pair with A form a friendship triangle.
⋆ Otherwise, BCD is a triangle of enemies.
Algorithms 5
Statement IV
Corollary I: If a vertex found a triangle that contains itself,
then the following is a sub-coloring of the graph:
Corollary II: If a vertex found a triangle that does not contain
itself, then the following is a sub-coloring of the graph:
Algorithms 6
Statement V
Theorem: A social graph with 6 vertices contains at least 2
uni-colored triangles (not necessarily of the same color).
Remark: There are only 3 possible colorings (up to a
symmetry) for a graph with 6 vertices and only 2 uni-
colored triangles.
Algorithms 7
Proof I: Case Analysis
⋆ Let ABC be a uni-colored triangle found by Statement IV
and let D, E, and F be the other 3 vertices.
⋆ If DEF is also a uni-colored triangle, then it is the second
uni-colored triangle. Otherwise, one of DE,DF,EF is not
colored as the uni-colored triangle.
⋆ Assume ABC is a blue triangle and the DE is a red edge.
Algorithms 8
Proof I: Case Analysis
⋆ If either D or E is connected to ABC with 2 blue edges,
then a second blue triangle is found.
Algorithms 9
Proof I: Case Analysis
⋆ Otherwise, D and E each is connected to ABC with at
least 2 red edges.
⋆ Therefore, at least 1 vertex from ABC is connected to both
D and E with red edges. Let this vertex be A.
⇒ ADE is a red triangle.
Algorithms 10
Proof II: Based on Statement III
⋆ Assume that there exists only one uni-colored triangle.
⋆ Omit one of the vertices of this triangle. By Statement III,
the remaining 5 vertices are colored with a blue 5-ring and
a red 5-ring. Let the omitted vertex be A.
Algorithms 11
Proof II: Based on Statement III
⋆ A has either at least 3 blue edges or at least 3 red edges.
Assume B,C,D are 3 blue neighbors of A.
⋆ If B,C,D are 3 consecutive vertices on the blue 5-ring,
then ABC and ACD are blue triangles.
Algorithms 12
Proof II: Based on Statement III
⋆ If A has at least 4 blue neighbors, then at least 3 of them
are consecutive on the blue 5-ring.
⋆ In the remaining case, A has exactly 2 red neighbors, say
D and E that must be adjacent on the red 5-ring.
⇒ ADE is a red triangle.
Algorithms 13
Proof III: Based on Statement IV
⋆ Assume towards contradiction that there exists only 1 uni-
colored triangle ABC. Assume ABC is a blue triangle.
⋆ Case I: There exists a blue edge connected to the triangle.
Assume that A has another blue neighbor D.
⋆ Corollaries I and II of Statement IV imply that D must find
another uni-colored triangle.
Algorithms 14
Proof III: Based on Statement IV
⋆ Case II: Assume that the blue triangle ABC is connected to
the rest of the vertices D,E,F with red edges.
Algorithms 15
Proof III: Based on Statement IV
⋆ If any of the pair DE,DF,EF is a red pair, then this pair
form 3 red triangles with A,B,C.
⋆ Otherwise, DEF is the second blue triangle.
Algorithms 16
Proof IV: Counting
⋆ There are exactly 20 =(
63
)
distinct triangles in the complete
graph K6.
⋆ Assume a coloring of the edges of K6 with blue and red.
⋆ Let T be the number of non uni-colored triangles.
⋆ Let S be the number of pairs of edges that intersect such
that each edge is colored with a different color.
Algorithms 17
Proof IV: Counting
⋆ Each uni-colored triangle contributes nothing to S wheras
a non uni-colored triangle contributes 2 to S.
⇒ S = 2T .
⋆ Each vertex contributes at most 2 · 3 = 6 to S in case it
has 2 edges of one color and 3 edges of the other color.
⇒ S ≤ 6 · 6 = 36.
⋆ It follows that 2T ≤ 36 implying that T ≤ 18.
⇒ There are at least 2 uni-colored triangles.
Algorithms 18
Coloring Edges with 3-Colors
Theorem: 17 people discuss 3 topics among themselves where
each pair discusses only 1 topic. Then, there are at least 3
people who discuss among themselves the same topic.
Proof:⋆ Consider vertex A.
⋆ There is a topic that A discusses with at least 6 people.
⋆ If 2 of these 6 people, B and C, discuss this topic, then
A,B,C are 3 people that discuss the same topic.
⋆ Otherwise, these 6 people discuss among themselves only
2 topics.
⋆ By Statement IV, there are 3 people among these 6
people who discuss the same topic.
Algorithms 19
Ramsey Numbers
⋆ R(h, ℓ) is the minimum integer n such that any graph with
n vertices contains either a clique with h vertices or an
independent set with ℓ vertices.
⋆ R(h, ℓ) is the minimum integer n such that any coloring of
the edges of the complete graph Kn with the colors blue
and red creates either a red clique of size h or a blue clique
of size ℓ.
⋆ Statements III and IV imply that R(3, 3) = 6.
Algorithms 20
Ramsey Numbers: Observations and Known Bounds
⋆ R(h, ℓ) = R(ℓ, h).
⋆ R(2, ℓ) = ℓ
⋆ R(h, h) ≤ 4R(h − 2, h) + 2.
⋆ h2h/2
e√
2≤ R(h, h)
⋆ c1ℓ2
ln ℓ ≤ R(3, ℓ) ≤ c2ℓ2
ln ℓ for some constants c1 < c2.
Algorithms 21
Generalized Ramsey Numbers
⋆ Let G be a family of graphs.
− Examples: Kn, Nn, Cn, trees, binary trees, . . .
⋆ R(G, k) is the minimum integer n such that any coloring
of the edges of the complete graph Kn with k colors has a
mono-chromatic sub-graph G from the family G.
⋆ R(G, 2) is the minimum integer n such that for any graph
with n vertices either the graph or its complement has a
sub-graph isomorphic to a graph G from the family G.
Algorithms 22
Examples
⋆ R({K3} , 2) = 6.
− Statement III implies that R({K3} , 2) > 5.
− Statement IV implies that R({K3} , 2) ≤ 6.
⋆ R({K3, C5} , 2) = 5.
− Statement III implies that R({K3, C5} , 2) ≤ 5.
− Trivially R({K3} , 2) > 4.
⋆ R({K3} , 3) ≤ 17.
− From the 17 people who discuss 3 topics statement.
Algorithms 23
Statement VI
Theorem: In any group of n ≥ 1 people, there exists a
committee of 1 ≤ k ≤ n members such that no 2 committee
members are friends and every person not included in the
committee is a friend of at least 1 committee member.
Proof: Construct the following committee. As long as there
exists a vertex v in the graph:
⋆ Add v to the committee.
⋆ Omit v and all of its neighbors from the graph.
Algorithms 24
Statement VI
The algorithm is correct:
⋆ Let u and v be 2 members in the committee. Assume v
joined the committee first. Then u cannot be a neighbor
of v.
− The committee is an independent set.
⋆ Let w be a non-committee vertex. Then w has a neighbor
v that is a committee member that caused w not to be
a committee member.
− The committee is a dominating set.
Algorithms 25
Statement VII
Theorem: Any group of n ≥ 2 people can be partitioned
into 2 subgroups such that at least half the friends of each
person belong to the subgroup of which that person is not
a member.
Notations: Let P be a partition of the set of all vertices V
into 2 disjoint sets:
⋆ Denote by ds(v) the degree of v in its own set.
⋆ Let
P
v∈V ds(v)
2 be the number of contained edges in P .
⋆ Denote by do(v) the degree of v in the other set.
⋆ Let
P
v∈V do(v)
2 be the number of crossed edges in P .
Algorithms 26
Statement VII: A Constructive Proof
Algorithm:
⋆ Start with an arbitrary partition P .
⋆ As long as there exists a vertex v such that ds(v) > do(v),
transfer v to the other set.
Correctness: If the algorithm terminates, then in the final
partition ds(v) ≤ do(v) for any vertex v.
Algorithms 27
Statement VII: Termination Proof
⋆ Define D(P ) to be the difference between the number of
cross edges and contained edges for the partition P .
⋆ D(P ) = 12
∑
v∈V (do(v) − ds(v)).
⋆ Let Q be the partition after transferring v to the other set
in teh partition P .
⇒ D(Q) = D(P ) + 2(ds(v) − do(v)) > D(P ).
⋆ Since D(Q) ≤ n2
4 for any partition, the algorithm
terminates.
Algorithms 28
Statement VIII
Theorem: Suppose everyone in a group of n ≥ 3 people is
a friend of at least half the people in the group. It is
possible to seat the group around a table in such a way
that everyone is seated between 2 of their friends.
Equivalent Theorem: Let G be a simple undirected graph
with n ≥ 3 vertices. Assume that d(v) ≥ n2 for any vertex
v. Then there exists a Hamilton Circuit in G.
Proof: A greedy algorithm finds the Hamilton circuit.
Algorithms 29
Statement IX
Theorem: Suppose in a group of n ≥ 2 people, any pair has
precisely one common friend. Then there is always a person
(the “politician”) who is everybody’s friend.
Equivalent Theorem: Let G be a simple undirected graph
with n vertices. Assume that any 2 vertices have precisely
one common neighbor. Then there exists a vertex v that is
adjacent to all other vertices.
Algorithms 30
Statement IX: The Windmill Graph
A stronger statement: The only possible graphs are the
windmill graphs for odd n ≥ 3.
Algorithms 31
Statement IX: Proof Outline
⋆ Assume that there exists a graph G obeying the theorem’s
conditions that is not a windmill graph.
⋆ G must be a d-regular graph: d(v) = d for each vertex v.
⋆ d2 − d + 1 = n.
⋆ This is impossible.
Algorithms 32
Statement IX: Infinite Graphs
⋆ There exists an infinite graph without a vertex that is
a neighbor to all other vertices such that every pair of
vertices has exactly one common neighbor.
⋆ Start with a 5-ring and add a new vertex when needed to
satisfy the condition for any pair of vertices.
Algorithms 33
Top Related