Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / generators / social.py @ 5cef0f13

History | View | Annotate | Download (23.4 KB)

1
"""
2
Famous social networks.
3
"""
4
import networkx as nx
5
__author__ = """\n""".join(['Jordi Torrents <jtorrents@milnou.net>',
6
                            'Katy Bold <kbold@princeton.edu>',
7
                            'Aric Hagberg <aric.hagberg@gmail.com)',
8
                            'Issa Annamoradnejad <i.moradnejad@gmail.com>'])
9

    
10
__all__ = ['karate_club_graph', 'davis_southern_women_graph',
11
           'florentine_families_graph', 'les_miserables_graph']
12

    
13

    
14
def karate_club_graph():
15
    """Returns Zachary's Karate Club graph.
16

17
    Each node in the returned graph has a node attribute 'club' that
18
    indicates the name of the club to which the member represented by that node
19
    belongs, either 'Mr. Hi' or 'Officer'.
20

21
    Examples
22
    --------
23
    To get the name of the club to which a node belongs::
24

25
        >>> import networkx as nx
26
        >>> G = nx.karate_club_graph()
27
        >>> G.nodes[5]['club']
28
        'Mr. Hi'
29
        >>> G.nodes[9]['club']
30
        'Officer'
31

32
    References
33
    ----------
34
    .. [1] Zachary, Wayne W.
35
       "An Information Flow Model for Conflict and Fission in Small Groups."
36
       *Journal of Anthropological Research*, 33, 452--473, (1977).
37

38
    .. [2] Data file from:
39
       http://vlado.fmf.uni-lj.si/pub/networks/data/Ucinet/UciData.htm
40
    """
41
    # Create the set of all members, and the members of each club.
42
    all_members = set(range(34))
43
    club1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21}
44
    # club2 = all_members - club1
45

    
46
    G = nx.Graph()
47
    G.add_nodes_from(all_members)
48
    G.name = "Zachary's Karate Club"
49

    
50
    zacharydat = """\
51
0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0
52
1 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0
53
1 1 0 1 0 0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 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1
83
0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1
84
0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0"""
85

    
86
    for row, line in enumerate(zacharydat.split('\n')):
87
        thisrow = [int(b) for b in line.split()]
88
        for col, entry in enumerate(thisrow):
89
            if entry == 1:
90
                G.add_edge(row, col)
91

    
92
    # Add the name of each member's club as a node attribute.
93
    for v in G:
94
        G.nodes[v]['club'] = 'Mr. Hi' if v in club1 else 'Officer'
95
    return G
96

    
97

    
98
def davis_southern_women_graph():
99
    """Returns Davis Southern women social network.
100

101
    This is a bipartite graph.
102

103
    References
104
    ----------
105
    .. [1] A. Davis, Gardner, B. B., Gardner, M. R., 1941. Deep South.
106
        University of Chicago Press, Chicago, IL.
107
    """
108
    G = nx.Graph()
109
    # Top nodes
110
    women = ["Evelyn Jefferson",
111
             "Laura Mandeville",
112
             "Theresa Anderson",
113
             "Brenda Rogers",
114
             "Charlotte McDowd",
115
             "Frances Anderson",
116
             "Eleanor Nye",
117
             "Pearl Oglethorpe",
118
             "Ruth DeSand",
119
             "Verne Sanderson",
120
             "Myra Liddel",
121
             "Katherina Rogers",
122
             "Sylvia Avondale",
123
             "Nora Fayette",
124
             "Helen Lloyd",
125
             "Dorothy Murchison",
126
             "Olivia Carleton",
127
             "Flora Price"]
128
    G.add_nodes_from(women, bipartite=0)
129
    # Bottom nodes
130
    events = ["E1",
131
              "E2",
132
              "E3",
133
              "E4",
134
              "E5",
135
              "E6",
136
              "E7",
137
              "E8",
138
              "E9",
139
              "E10",
140
              "E11",
141
              "E12",
142
              "E13",
143
              "E14"]
144
    G.add_nodes_from(events, bipartite=1)
145

    
146
    G.add_edges_from([("Evelyn Jefferson", "E1"),
147
                      ("Evelyn Jefferson", "E2"),
148
                      ("Evelyn Jefferson", "E3"),
149
                      ("Evelyn Jefferson", "E4"),
150
                      ("Evelyn Jefferson", "E5"),
151
                      ("Evelyn Jefferson", "E6"),
152
                      ("Evelyn Jefferson", "E8"),
153
                      ("Evelyn Jefferson", "E9"),
154
                      ("Laura Mandeville", "E1"),
155
                      ("Laura Mandeville", "E2"),
156
                      ("Laura Mandeville", "E3"),
157
                      ("Laura Mandeville", "E5"),
158
                      ("Laura Mandeville", "E6"),
159
                      ("Laura Mandeville", "E7"),
160
                      ("Laura Mandeville", "E8"),
161
                      ("Theresa Anderson", "E2"),
162
                      ("Theresa Anderson", "E3"),
163
                      ("Theresa Anderson", "E4"),
164
                      ("Theresa Anderson", "E5"),
165
                      ("Theresa Anderson", "E6"),
166
                      ("Theresa Anderson", "E7"),
167
                      ("Theresa Anderson", "E8"),
168
                      ("Theresa Anderson", "E9"),
169
                      ("Brenda Rogers", "E1"),
170
                      ("Brenda Rogers", "E3"),
171
                      ("Brenda Rogers", "E4"),
172
                      ("Brenda Rogers", "E5"),
173
                      ("Brenda Rogers", "E6"),
174
                      ("Brenda Rogers", "E7"),
175
                      ("Brenda Rogers", "E8"),
176
                      ("Charlotte McDowd", "E3"),
177
                      ("Charlotte McDowd", "E4"),
178
                      ("Charlotte McDowd", "E5"),
179
                      ("Charlotte McDowd", "E7"),
180
                      ("Frances Anderson", "E3"),
181
                      ("Frances Anderson", "E5"),
182
                      ("Frances Anderson", "E6"),
183
                      ("Frances Anderson", "E8"),
184
                      ("Eleanor Nye", "E5"),
185
                      ("Eleanor Nye", "E6"),
186
                      ("Eleanor Nye", "E7"),
187
                      ("Eleanor Nye", "E8"),
188
                      ("Pearl Oglethorpe", "E6"),
189
                      ("Pearl Oglethorpe", "E8"),
190
                      ("Pearl Oglethorpe", "E9"),
191
                      ("Ruth DeSand", "E5"),
192
                      ("Ruth DeSand", "E7"),
193
                      ("Ruth DeSand", "E8"),
194
                      ("Ruth DeSand", "E9"),
195
                      ("Verne Sanderson", "E7"),
196
                      ("Verne Sanderson", "E8"),
197
                      ("Verne Sanderson", "E9"),
198
                      ("Verne Sanderson", "E12"),
199
                      ("Myra Liddel", "E8"),
200
                      ("Myra Liddel", "E9"),
201
                      ("Myra Liddel", "E10"),
202
                      ("Myra Liddel", "E12"),
203
                      ("Katherina Rogers", "E8"),
204
                      ("Katherina Rogers", "E9"),
205
                      ("Katherina Rogers", "E10"),
206
                      ("Katherina Rogers", "E12"),
207
                      ("Katherina Rogers", "E13"),
208
                      ("Katherina Rogers", "E14"),
209
                      ("Sylvia Avondale", "E7"),
210
                      ("Sylvia Avondale", "E8"),
211
                      ("Sylvia Avondale", "E9"),
212
                      ("Sylvia Avondale", "E10"),
213
                      ("Sylvia Avondale", "E12"),
214
                      ("Sylvia Avondale", "E13"),
215
                      ("Sylvia Avondale", "E14"),
216
                      ("Nora Fayette", "E6"),
217
                      ("Nora Fayette", "E7"),
218
                      ("Nora Fayette", "E9"),
219
                      ("Nora Fayette", "E10"),
220
                      ("Nora Fayette", "E11"),
221
                      ("Nora Fayette", "E12"),
222
                      ("Nora Fayette", "E13"),
223
                      ("Nora Fayette", "E14"),
224
                      ("Helen Lloyd", "E7"),
225
                      ("Helen Lloyd", "E8"),
226
                      ("Helen Lloyd", "E10"),
227
                      ("Helen Lloyd", "E11"),
228
                      ("Helen Lloyd", "E12"),
229
                      ("Dorothy Murchison", "E8"),
230
                      ("Dorothy Murchison", "E9"),
231
                      ("Olivia Carleton", "E9"),
232
                      ("Olivia Carleton", "E11"),
233
                      ("Flora Price", "E9"),
234
                      ("Flora Price", "E11")])
235
    G.graph['top'] = women
236
    G.graph['bottom'] = events
237
    return G
238

    
239

    
240
def florentine_families_graph():
241
    """Returns Florentine families graph.
242

243
    References
244
    ----------
245
    .. [1] Ronald L. Breiger and Philippa E. Pattison
246
       Cumulated social roles: The duality of persons and their algebras,1
247
       Social Networks, Volume 8, Issue 3, September 1986, Pages 215-256
248
    """
249
    G = nx.Graph()
250
    G.add_edge('Acciaiuoli', 'Medici')
251
    G.add_edge('Castellani', 'Peruzzi')
252
    G.add_edge('Castellani', 'Strozzi')
253
    G.add_edge('Castellani', 'Barbadori')
254
    G.add_edge('Medici', 'Barbadori')
255
    G.add_edge('Medici', 'Ridolfi')
256
    G.add_edge('Medici', 'Tornabuoni')
257
    G.add_edge('Medici', 'Albizzi')
258
    G.add_edge('Medici', 'Salviati')
259
    G.add_edge('Salviati', 'Pazzi')
260
    G.add_edge('Peruzzi', 'Strozzi')
261
    G.add_edge('Peruzzi', 'Bischeri')
262
    G.add_edge('Strozzi', 'Ridolfi')
263
    G.add_edge('Strozzi', 'Bischeri')
264
    G.add_edge('Ridolfi', 'Tornabuoni')
265
    G.add_edge('Tornabuoni', 'Guadagni')
266
    G.add_edge('Albizzi', 'Ginori')
267
    G.add_edge('Albizzi', 'Guadagni')
268
    G.add_edge('Bischeri', 'Guadagni')
269
    G.add_edge('Guadagni', 'Lamberteschi')
270
    return G
271

    
272

    
273
def les_miserables_graph():
274
    """Returns coappearance network of characters in the novel Les Miserables.
275

276
    References
277
    ----------
278
    .. [1] D. E. Knuth, 1993.
279
       The Stanford GraphBase: a platform for combinatorial computing,
280
       pp. 74-87. New York: AcM Press.
281
    """
282
    G = nx.Graph()
283
    G.add_edge('Napoleon', 'Myriel', weight=1)
284
    G.add_edge('MlleBaptistine', 'Myriel', weight=8)
285
    G.add_edge('MmeMagloire', 'Myriel', weight=10)
286
    G.add_edge('MmeMagloire', 'MlleBaptistine', weight=6)
287
    G.add_edge('CountessDeLo', 'Myriel', weight=1)
288
    G.add_edge('Geborand', 'Myriel', weight=1)
289
    G.add_edge('Champtercier', 'Myriel', weight=1)
290
    G.add_edge('Cravatte', 'Myriel', weight=1)
291
    G.add_edge('Count', 'Myriel', weight=2)
292
    G.add_edge('OldMan', 'Myriel', weight=1)
293
    G.add_edge('Valjean', 'Labarre', weight=1)
294
    G.add_edge('Valjean', 'MmeMagloire', weight=3)
295
    G.add_edge('Valjean', 'MlleBaptistine', weight=3)
296
    G.add_edge('Valjean', 'Myriel', weight=5)
297
    G.add_edge('Marguerite', 'Valjean', weight=1)
298
    G.add_edge('MmeDeR', 'Valjean', weight=1)
299
    G.add_edge('Isabeau', 'Valjean', weight=1)
300
    G.add_edge('Gervais', 'Valjean', weight=1)
301
    G.add_edge('Listolier', 'Tholomyes', weight=4)
302
    G.add_edge('Fameuil', 'Tholomyes', weight=4)
303
    G.add_edge('Fameuil', 'Listolier', weight=4)
304
    G.add_edge('Blacheville', 'Tholomyes', weight=4)
305
    G.add_edge('Blacheville', 'Listolier', weight=4)
306
    G.add_edge('Blacheville', 'Fameuil', weight=4)
307
    G.add_edge('Favourite', 'Tholomyes', weight=3)
308
    G.add_edge('Favourite', 'Listolier', weight=3)
309
    G.add_edge('Favourite', 'Fameuil', weight=3)
310
    G.add_edge('Favourite', 'Blacheville', weight=4)
311
    G.add_edge('Dahlia', 'Tholomyes', weight=3)
312
    G.add_edge('Dahlia', 'Listolier', weight=3)
313
    G.add_edge('Dahlia', 'Fameuil', weight=3)
314
    G.add_edge('Dahlia', 'Blacheville', weight=3)
315
    G.add_edge('Dahlia', 'Favourite', weight=5)
316
    G.add_edge('Zephine', 'Tholomyes', weight=3)
317
    G.add_edge('Zephine', 'Listolier', weight=3)
318
    G.add_edge('Zephine', 'Fameuil', weight=3)
319
    G.add_edge('Zephine', 'Blacheville', weight=3)
320
    G.add_edge('Zephine', 'Favourite', weight=4)
321
    G.add_edge('Zephine', 'Dahlia', weight=4)
322
    G.add_edge('Fantine', 'Tholomyes', weight=3)
323
    G.add_edge('Fantine', 'Listolier', weight=3)
324
    G.add_edge('Fantine', 'Fameuil', weight=3)
325
    G.add_edge('Fantine', 'Blacheville', weight=3)
326
    G.add_edge('Fantine', 'Favourite', weight=4)
327
    G.add_edge('Fantine', 'Dahlia', weight=4)
328
    G.add_edge('Fantine', 'Zephine', weight=4)
329
    G.add_edge('Fantine', 'Marguerite', weight=2)
330
    G.add_edge('Fantine', 'Valjean', weight=9)
331
    G.add_edge('MmeThenardier', 'Fantine', weight=2)
332
    G.add_edge('MmeThenardier', 'Valjean', weight=7)
333
    G.add_edge('Thenardier', 'MmeThenardier', weight=13)
334
    G.add_edge('Thenardier', 'Fantine', weight=1)
335
    G.add_edge('Thenardier', 'Valjean', weight=12)
336
    G.add_edge('Cosette', 'MmeThenardier', weight=4)
337
    G.add_edge('Cosette', 'Valjean', weight=31)
338
    G.add_edge('Cosette', 'Tholomyes', weight=1)
339
    G.add_edge('Cosette', 'Thenardier', weight=1)
340
    G.add_edge('Javert', 'Valjean', weight=17)
341
    G.add_edge('Javert', 'Fantine', weight=5)
342
    G.add_edge('Javert', 'Thenardier', weight=5)
343
    G.add_edge('Javert', 'MmeThenardier', weight=1)
344
    G.add_edge('Javert', 'Cosette', weight=1)
345
    G.add_edge('Fauchelevent', 'Valjean', weight=8)
346
    G.add_edge('Fauchelevent', 'Javert', weight=1)
347
    G.add_edge('Bamatabois', 'Fantine', weight=1)
348
    G.add_edge('Bamatabois', 'Javert', weight=1)
349
    G.add_edge('Bamatabois', 'Valjean', weight=2)
350
    G.add_edge('Perpetue', 'Fantine', weight=1)
351
    G.add_edge('Simplice', 'Perpetue', weight=2)
352
    G.add_edge('Simplice', 'Valjean', weight=3)
353
    G.add_edge('Simplice', 'Fantine', weight=2)
354
    G.add_edge('Simplice', 'Javert', weight=1)
355
    G.add_edge('Scaufflaire', 'Valjean', weight=1)
356
    G.add_edge('Woman1', 'Valjean', weight=2)
357
    G.add_edge('Woman1', 'Javert', weight=1)
358
    G.add_edge('Judge', 'Valjean', weight=3)
359
    G.add_edge('Judge', 'Bamatabois', weight=2)
360
    G.add_edge('Champmathieu', 'Valjean', weight=3)
361
    G.add_edge('Champmathieu', 'Judge', weight=3)
362
    G.add_edge('Champmathieu', 'Bamatabois', weight=2)
363
    G.add_edge('Brevet', 'Judge', weight=2)
364
    G.add_edge('Brevet', 'Champmathieu', weight=2)
365
    G.add_edge('Brevet', 'Valjean', weight=2)
366
    G.add_edge('Brevet', 'Bamatabois', weight=1)
367
    G.add_edge('Chenildieu', 'Judge', weight=2)
368
    G.add_edge('Chenildieu', 'Champmathieu', weight=2)
369
    G.add_edge('Chenildieu', 'Brevet', weight=2)
370
    G.add_edge('Chenildieu', 'Valjean', weight=2)
371
    G.add_edge('Chenildieu', 'Bamatabois', weight=1)
372
    G.add_edge('Cochepaille', 'Judge', weight=2)
373
    G.add_edge('Cochepaille', 'Champmathieu', weight=2)
374
    G.add_edge('Cochepaille', 'Brevet', weight=2)
375
    G.add_edge('Cochepaille', 'Chenildieu', weight=2)
376
    G.add_edge('Cochepaille', 'Valjean', weight=2)
377
    G.add_edge('Cochepaille', 'Bamatabois', weight=1)
378
    G.add_edge('Pontmercy', 'Thenardier', weight=1)
379
    G.add_edge('Boulatruelle', 'Thenardier', weight=1)
380
    G.add_edge('Eponine', 'MmeThenardier', weight=2)
381
    G.add_edge('Eponine', 'Thenardier', weight=3)
382
    G.add_edge('Anzelma', 'Eponine', weight=2)
383
    G.add_edge('Anzelma', 'Thenardier', weight=2)
384
    G.add_edge('Anzelma', 'MmeThenardier', weight=1)
385
    G.add_edge('Woman2', 'Valjean', weight=3)
386
    G.add_edge('Woman2', 'Cosette', weight=1)
387
    G.add_edge('Woman2', 'Javert', weight=1)
388
    G.add_edge('MotherInnocent', 'Fauchelevent', weight=3)
389
    G.add_edge('MotherInnocent', 'Valjean', weight=1)
390
    G.add_edge('Gribier', 'Fauchelevent', weight=2)
391
    G.add_edge('MmeBurgon', 'Jondrette', weight=1)
392
    G.add_edge('Gavroche', 'MmeBurgon', weight=2)
393
    G.add_edge('Gavroche', 'Thenardier', weight=1)
394
    G.add_edge('Gavroche', 'Javert', weight=1)
395
    G.add_edge('Gavroche', 'Valjean', weight=1)
396
    G.add_edge('Gillenormand', 'Cosette', weight=3)
397
    G.add_edge('Gillenormand', 'Valjean', weight=2)
398
    G.add_edge('Magnon', 'Gillenormand', weight=1)
399
    G.add_edge('Magnon', 'MmeThenardier', weight=1)
400
    G.add_edge('MlleGillenormand', 'Gillenormand', weight=9)
401
    G.add_edge('MlleGillenormand', 'Cosette', weight=2)
402
    G.add_edge('MlleGillenormand', 'Valjean', weight=2)
403
    G.add_edge('MmePontmercy', 'MlleGillenormand', weight=1)
404
    G.add_edge('MmePontmercy', 'Pontmercy', weight=1)
405
    G.add_edge('MlleVaubois', 'MlleGillenormand', weight=1)
406
    G.add_edge('LtGillenormand', 'MlleGillenormand', weight=2)
407
    G.add_edge('LtGillenormand', 'Gillenormand', weight=1)
408
    G.add_edge('LtGillenormand', 'Cosette', weight=1)
409
    G.add_edge('Marius', 'MlleGillenormand', weight=6)
410
    G.add_edge('Marius', 'Gillenormand', weight=12)
411
    G.add_edge('Marius', 'Pontmercy', weight=1)
412
    G.add_edge('Marius', 'LtGillenormand', weight=1)
413
    G.add_edge('Marius', 'Cosette', weight=21)
414
    G.add_edge('Marius', 'Valjean', weight=19)
415
    G.add_edge('Marius', 'Tholomyes', weight=1)
416
    G.add_edge('Marius', 'Thenardier', weight=2)
417
    G.add_edge('Marius', 'Eponine', weight=5)
418
    G.add_edge('Marius', 'Gavroche', weight=4)
419
    G.add_edge('BaronessT', 'Gillenormand', weight=1)
420
    G.add_edge('BaronessT', 'Marius', weight=1)
421
    G.add_edge('Mabeuf', 'Marius', weight=1)
422
    G.add_edge('Mabeuf', 'Eponine', weight=1)
423
    G.add_edge('Mabeuf', 'Gavroche', weight=1)
424
    G.add_edge('Enjolras', 'Marius', weight=7)
425
    G.add_edge('Enjolras', 'Gavroche', weight=7)
426
    G.add_edge('Enjolras', 'Javert', weight=6)
427
    G.add_edge('Enjolras', 'Mabeuf', weight=1)
428
    G.add_edge('Enjolras', 'Valjean', weight=4)
429
    G.add_edge('Combeferre', 'Enjolras', weight=15)
430
    G.add_edge('Combeferre', 'Marius', weight=5)
431
    G.add_edge('Combeferre', 'Gavroche', weight=6)
432
    G.add_edge('Combeferre', 'Mabeuf', weight=2)
433
    G.add_edge('Prouvaire', 'Gavroche', weight=1)
434
    G.add_edge('Prouvaire', 'Enjolras', weight=4)
435
    G.add_edge('Prouvaire', 'Combeferre', weight=2)
436
    G.add_edge('Feuilly', 'Gavroche', weight=2)
437
    G.add_edge('Feuilly', 'Enjolras', weight=6)
438
    G.add_edge('Feuilly', 'Prouvaire', weight=2)
439
    G.add_edge('Feuilly', 'Combeferre', weight=5)
440
    G.add_edge('Feuilly', 'Mabeuf', weight=1)
441
    G.add_edge('Feuilly', 'Marius', weight=1)
442
    G.add_edge('Courfeyrac', 'Marius', weight=9)
443
    G.add_edge('Courfeyrac', 'Enjolras', weight=17)
444
    G.add_edge('Courfeyrac', 'Combeferre', weight=13)
445
    G.add_edge('Courfeyrac', 'Gavroche', weight=7)
446
    G.add_edge('Courfeyrac', 'Mabeuf', weight=2)
447
    G.add_edge('Courfeyrac', 'Eponine', weight=1)
448
    G.add_edge('Courfeyrac', 'Feuilly', weight=6)
449
    G.add_edge('Courfeyrac', 'Prouvaire', weight=3)
450
    G.add_edge('Bahorel', 'Combeferre', weight=5)
451
    G.add_edge('Bahorel', 'Gavroche', weight=5)
452
    G.add_edge('Bahorel', 'Courfeyrac', weight=6)
453
    G.add_edge('Bahorel', 'Mabeuf', weight=2)
454
    G.add_edge('Bahorel', 'Enjolras', weight=4)
455
    G.add_edge('Bahorel', 'Feuilly', weight=3)
456
    G.add_edge('Bahorel', 'Prouvaire', weight=2)
457
    G.add_edge('Bahorel', 'Marius', weight=1)
458
    G.add_edge('Bossuet', 'Marius', weight=5)
459
    G.add_edge('Bossuet', 'Courfeyrac', weight=12)
460
    G.add_edge('Bossuet', 'Gavroche', weight=5)
461
    G.add_edge('Bossuet', 'Bahorel', weight=4)
462
    G.add_edge('Bossuet', 'Enjolras', weight=10)
463
    G.add_edge('Bossuet', 'Feuilly', weight=6)
464
    G.add_edge('Bossuet', 'Prouvaire', weight=2)
465
    G.add_edge('Bossuet', 'Combeferre', weight=9)
466
    G.add_edge('Bossuet', 'Mabeuf', weight=1)
467
    G.add_edge('Bossuet', 'Valjean', weight=1)
468
    G.add_edge('Joly', 'Bahorel', weight=5)
469
    G.add_edge('Joly', 'Bossuet', weight=7)
470
    G.add_edge('Joly', 'Gavroche', weight=3)
471
    G.add_edge('Joly', 'Courfeyrac', weight=5)
472
    G.add_edge('Joly', 'Enjolras', weight=5)
473
    G.add_edge('Joly', 'Feuilly', weight=5)
474
    G.add_edge('Joly', 'Prouvaire', weight=2)
475
    G.add_edge('Joly', 'Combeferre', weight=5)
476
    G.add_edge('Joly', 'Mabeuf', weight=1)
477
    G.add_edge('Joly', 'Marius', weight=2)
478
    G.add_edge('Grantaire', 'Bossuet', weight=3)
479
    G.add_edge('Grantaire', 'Enjolras', weight=3)
480
    G.add_edge('Grantaire', 'Combeferre', weight=1)
481
    G.add_edge('Grantaire', 'Courfeyrac', weight=2)
482
    G.add_edge('Grantaire', 'Joly', weight=2)
483
    G.add_edge('Grantaire', 'Gavroche', weight=1)
484
    G.add_edge('Grantaire', 'Bahorel', weight=1)
485
    G.add_edge('Grantaire', 'Feuilly', weight=1)
486
    G.add_edge('Grantaire', 'Prouvaire', weight=1)
487
    G.add_edge('MotherPlutarch', 'Mabeuf', weight=3)
488
    G.add_edge('Gueulemer', 'Thenardier', weight=5)
489
    G.add_edge('Gueulemer', 'Valjean', weight=1)
490
    G.add_edge('Gueulemer', 'MmeThenardier', weight=1)
491
    G.add_edge('Gueulemer', 'Javert', weight=1)
492
    G.add_edge('Gueulemer', 'Gavroche', weight=1)
493
    G.add_edge('Gueulemer', 'Eponine', weight=1)
494
    G.add_edge('Babet', 'Thenardier', weight=6)
495
    G.add_edge('Babet', 'Gueulemer', weight=6)
496
    G.add_edge('Babet', 'Valjean', weight=1)
497
    G.add_edge('Babet', 'MmeThenardier', weight=1)
498
    G.add_edge('Babet', 'Javert', weight=2)
499
    G.add_edge('Babet', 'Gavroche', weight=1)
500
    G.add_edge('Babet', 'Eponine', weight=1)
501
    G.add_edge('Claquesous', 'Thenardier', weight=4)
502
    G.add_edge('Claquesous', 'Babet', weight=4)
503
    G.add_edge('Claquesous', 'Gueulemer', weight=4)
504
    G.add_edge('Claquesous', 'Valjean', weight=1)
505
    G.add_edge('Claquesous', 'MmeThenardier', weight=1)
506
    G.add_edge('Claquesous', 'Javert', weight=1)
507
    G.add_edge('Claquesous', 'Eponine', weight=1)
508
    G.add_edge('Claquesous', 'Enjolras', weight=1)
509
    G.add_edge('Montparnasse', 'Javert', weight=1)
510
    G.add_edge('Montparnasse', 'Babet', weight=2)
511
    G.add_edge('Montparnasse', 'Gueulemer', weight=2)
512
    G.add_edge('Montparnasse', 'Claquesous', weight=2)
513
    G.add_edge('Montparnasse', 'Valjean', weight=1)
514
    G.add_edge('Montparnasse', 'Gavroche', weight=1)
515
    G.add_edge('Montparnasse', 'Eponine', weight=1)
516
    G.add_edge('Montparnasse', 'Thenardier', weight=1)
517
    G.add_edge('Toussaint', 'Cosette', weight=2)
518
    G.add_edge('Toussaint', 'Javert', weight=1)
519
    G.add_edge('Toussaint', 'Valjean', weight=1)
520
    G.add_edge('Child1', 'Gavroche', weight=2)
521
    G.add_edge('Child2', 'Gavroche', weight=2)
522
    G.add_edge('Child2', 'Child1', weight=3)
523
    G.add_edge('Brujon', 'Babet', weight=3)
524
    G.add_edge('Brujon', 'Gueulemer', weight=3)
525
    G.add_edge('Brujon', 'Thenardier', weight=3)
526
    G.add_edge('Brujon', 'Gavroche', weight=1)
527
    G.add_edge('Brujon', 'Eponine', weight=1)
528
    G.add_edge('Brujon', 'Claquesous', weight=1)
529
    G.add_edge('Brujon', 'Montparnasse', weight=1)
530
    G.add_edge('MmeHucheloup', 'Bossuet', weight=1)
531
    G.add_edge('MmeHucheloup', 'Joly', weight=1)
532
    G.add_edge('MmeHucheloup', 'Grantaire', weight=1)
533
    G.add_edge('MmeHucheloup', 'Bahorel', weight=1)
534
    G.add_edge('MmeHucheloup', 'Courfeyrac', weight=1)
535
    G.add_edge('MmeHucheloup', 'Gavroche', weight=1)
536
    G.add_edge('MmeHucheloup', 'Enjolras', weight=1)
537
    return G