Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/networkx/generators/social.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 """ | |
2 Famous social networks. | |
3 """ | |
4 import networkx as nx | |
5 | |
6 __all__ = [ | |
7 "karate_club_graph", | |
8 "davis_southern_women_graph", | |
9 "florentine_families_graph", | |
10 "les_miserables_graph", | |
11 ] | |
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 >>> G = nx.karate_club_graph() | |
26 >>> G.nodes[5]["club"] | |
27 'Mr. Hi' | |
28 >>> G.nodes[9]["club"] | |
29 'Officer' | |
30 | |
31 References | |
32 ---------- | |
33 .. [1] Zachary, Wayne W. | |
34 "An Information Flow Model for Conflict and Fission in Small Groups." | |
35 *Journal of Anthropological Research*, 33, 452--473, (1977). | |
36 | |
37 .. [2] Data file from: | |
38 http://vlado.fmf.uni-lj.si/pub/networks/data/Ucinet/UciData.htm | |
39 """ | |
40 # Create the set of all members, and the members of each club. | |
41 all_members = set(range(34)) | |
42 club1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21} | |
43 # club2 = all_members - club1 | |
44 | |
45 G = nx.Graph() | |
46 G.add_nodes_from(all_members) | |
47 G.name = "Zachary's Karate Club" | |
48 | |
49 zacharydat = """\ | |
50 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 | |
51 1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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 | |
80 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 | |
81 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 | |
82 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 | |
83 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""" | |
84 | |
85 for row, line in enumerate(zacharydat.split("\n")): | |
86 thisrow = [int(b) for b in line.split()] | |
87 for col, entry in enumerate(thisrow): | |
88 if entry == 1: | |
89 G.add_edge(row, col) | |
90 | |
91 # Add the name of each member's club as a node attribute. | |
92 for v in G: | |
93 G.nodes[v]["club"] = "Mr. Hi" if v in club1 else "Officer" | |
94 return G | |
95 | |
96 | |
97 def davis_southern_women_graph(): | |
98 """Returns Davis Southern women social network. | |
99 | |
100 This is a bipartite graph. | |
101 | |
102 References | |
103 ---------- | |
104 .. [1] A. Davis, Gardner, B. B., Gardner, M. R., 1941. Deep South. | |
105 University of Chicago Press, Chicago, IL. | |
106 """ | |
107 G = nx.Graph() | |
108 # Top nodes | |
109 women = [ | |
110 "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 ] | |
129 G.add_nodes_from(women, bipartite=0) | |
130 # Bottom nodes | |
131 events = [ | |
132 "E1", | |
133 "E2", | |
134 "E3", | |
135 "E4", | |
136 "E5", | |
137 "E6", | |
138 "E7", | |
139 "E8", | |
140 "E9", | |
141 "E10", | |
142 "E11", | |
143 "E12", | |
144 "E13", | |
145 "E14", | |
146 ] | |
147 G.add_nodes_from(events, bipartite=1) | |
148 | |
149 G.add_edges_from( | |
150 [ | |
151 ("Evelyn Jefferson", "E1"), | |
152 ("Evelyn Jefferson", "E2"), | |
153 ("Evelyn Jefferson", "E3"), | |
154 ("Evelyn Jefferson", "E4"), | |
155 ("Evelyn Jefferson", "E5"), | |
156 ("Evelyn Jefferson", "E6"), | |
157 ("Evelyn Jefferson", "E8"), | |
158 ("Evelyn Jefferson", "E9"), | |
159 ("Laura Mandeville", "E1"), | |
160 ("Laura Mandeville", "E2"), | |
161 ("Laura Mandeville", "E3"), | |
162 ("Laura Mandeville", "E5"), | |
163 ("Laura Mandeville", "E6"), | |
164 ("Laura Mandeville", "E7"), | |
165 ("Laura Mandeville", "E8"), | |
166 ("Theresa Anderson", "E2"), | |
167 ("Theresa Anderson", "E3"), | |
168 ("Theresa Anderson", "E4"), | |
169 ("Theresa Anderson", "E5"), | |
170 ("Theresa Anderson", "E6"), | |
171 ("Theresa Anderson", "E7"), | |
172 ("Theresa Anderson", "E8"), | |
173 ("Theresa Anderson", "E9"), | |
174 ("Brenda Rogers", "E1"), | |
175 ("Brenda Rogers", "E3"), | |
176 ("Brenda Rogers", "E4"), | |
177 ("Brenda Rogers", "E5"), | |
178 ("Brenda Rogers", "E6"), | |
179 ("Brenda Rogers", "E7"), | |
180 ("Brenda Rogers", "E8"), | |
181 ("Charlotte McDowd", "E3"), | |
182 ("Charlotte McDowd", "E4"), | |
183 ("Charlotte McDowd", "E5"), | |
184 ("Charlotte McDowd", "E7"), | |
185 ("Frances Anderson", "E3"), | |
186 ("Frances Anderson", "E5"), | |
187 ("Frances Anderson", "E6"), | |
188 ("Frances Anderson", "E8"), | |
189 ("Eleanor Nye", "E5"), | |
190 ("Eleanor Nye", "E6"), | |
191 ("Eleanor Nye", "E7"), | |
192 ("Eleanor Nye", "E8"), | |
193 ("Pearl Oglethorpe", "E6"), | |
194 ("Pearl Oglethorpe", "E8"), | |
195 ("Pearl Oglethorpe", "E9"), | |
196 ("Ruth DeSand", "E5"), | |
197 ("Ruth DeSand", "E7"), | |
198 ("Ruth DeSand", "E8"), | |
199 ("Ruth DeSand", "E9"), | |
200 ("Verne Sanderson", "E7"), | |
201 ("Verne Sanderson", "E8"), | |
202 ("Verne Sanderson", "E9"), | |
203 ("Verne Sanderson", "E12"), | |
204 ("Myra Liddel", "E8"), | |
205 ("Myra Liddel", "E9"), | |
206 ("Myra Liddel", "E10"), | |
207 ("Myra Liddel", "E12"), | |
208 ("Katherina Rogers", "E8"), | |
209 ("Katherina Rogers", "E9"), | |
210 ("Katherina Rogers", "E10"), | |
211 ("Katherina Rogers", "E12"), | |
212 ("Katherina Rogers", "E13"), | |
213 ("Katherina Rogers", "E14"), | |
214 ("Sylvia Avondale", "E7"), | |
215 ("Sylvia Avondale", "E8"), | |
216 ("Sylvia Avondale", "E9"), | |
217 ("Sylvia Avondale", "E10"), | |
218 ("Sylvia Avondale", "E12"), | |
219 ("Sylvia Avondale", "E13"), | |
220 ("Sylvia Avondale", "E14"), | |
221 ("Nora Fayette", "E6"), | |
222 ("Nora Fayette", "E7"), | |
223 ("Nora Fayette", "E9"), | |
224 ("Nora Fayette", "E10"), | |
225 ("Nora Fayette", "E11"), | |
226 ("Nora Fayette", "E12"), | |
227 ("Nora Fayette", "E13"), | |
228 ("Nora Fayette", "E14"), | |
229 ("Helen Lloyd", "E7"), | |
230 ("Helen Lloyd", "E8"), | |
231 ("Helen Lloyd", "E10"), | |
232 ("Helen Lloyd", "E11"), | |
233 ("Helen Lloyd", "E12"), | |
234 ("Dorothy Murchison", "E8"), | |
235 ("Dorothy Murchison", "E9"), | |
236 ("Olivia Carleton", "E9"), | |
237 ("Olivia Carleton", "E11"), | |
238 ("Flora Price", "E9"), | |
239 ("Flora Price", "E11"), | |
240 ] | |
241 ) | |
242 G.graph["top"] = women | |
243 G.graph["bottom"] = events | |
244 return G | |
245 | |
246 | |
247 def florentine_families_graph(): | |
248 """Returns Florentine families graph. | |
249 | |
250 References | |
251 ---------- | |
252 .. [1] Ronald L. Breiger and Philippa E. Pattison | |
253 Cumulated social roles: The duality of persons and their algebras,1 | |
254 Social Networks, Volume 8, Issue 3, September 1986, Pages 215-256 | |
255 """ | |
256 G = nx.Graph() | |
257 G.add_edge("Acciaiuoli", "Medici") | |
258 G.add_edge("Castellani", "Peruzzi") | |
259 G.add_edge("Castellani", "Strozzi") | |
260 G.add_edge("Castellani", "Barbadori") | |
261 G.add_edge("Medici", "Barbadori") | |
262 G.add_edge("Medici", "Ridolfi") | |
263 G.add_edge("Medici", "Tornabuoni") | |
264 G.add_edge("Medici", "Albizzi") | |
265 G.add_edge("Medici", "Salviati") | |
266 G.add_edge("Salviati", "Pazzi") | |
267 G.add_edge("Peruzzi", "Strozzi") | |
268 G.add_edge("Peruzzi", "Bischeri") | |
269 G.add_edge("Strozzi", "Ridolfi") | |
270 G.add_edge("Strozzi", "Bischeri") | |
271 G.add_edge("Ridolfi", "Tornabuoni") | |
272 G.add_edge("Tornabuoni", "Guadagni") | |
273 G.add_edge("Albizzi", "Ginori") | |
274 G.add_edge("Albizzi", "Guadagni") | |
275 G.add_edge("Bischeri", "Guadagni") | |
276 G.add_edge("Guadagni", "Lamberteschi") | |
277 return G | |
278 | |
279 | |
280 def les_miserables_graph(): | |
281 """Returns coappearance network of characters in the novel Les Miserables. | |
282 | |
283 References | |
284 ---------- | |
285 .. [1] D. E. Knuth, 1993. | |
286 The Stanford GraphBase: a platform for combinatorial computing, | |
287 pp. 74-87. New York: AcM Press. | |
288 """ | |
289 G = nx.Graph() | |
290 G.add_edge("Napoleon", "Myriel", weight=1) | |
291 G.add_edge("MlleBaptistine", "Myriel", weight=8) | |
292 G.add_edge("MmeMagloire", "Myriel", weight=10) | |
293 G.add_edge("MmeMagloire", "MlleBaptistine", weight=6) | |
294 G.add_edge("CountessDeLo", "Myriel", weight=1) | |
295 G.add_edge("Geborand", "Myriel", weight=1) | |
296 G.add_edge("Champtercier", "Myriel", weight=1) | |
297 G.add_edge("Cravatte", "Myriel", weight=1) | |
298 G.add_edge("Count", "Myriel", weight=2) | |
299 G.add_edge("OldMan", "Myriel", weight=1) | |
300 G.add_edge("Valjean", "Labarre", weight=1) | |
301 G.add_edge("Valjean", "MmeMagloire", weight=3) | |
302 G.add_edge("Valjean", "MlleBaptistine", weight=3) | |
303 G.add_edge("Valjean", "Myriel", weight=5) | |
304 G.add_edge("Marguerite", "Valjean", weight=1) | |
305 G.add_edge("MmeDeR", "Valjean", weight=1) | |
306 G.add_edge("Isabeau", "Valjean", weight=1) | |
307 G.add_edge("Gervais", "Valjean", weight=1) | |
308 G.add_edge("Listolier", "Tholomyes", weight=4) | |
309 G.add_edge("Fameuil", "Tholomyes", weight=4) | |
310 G.add_edge("Fameuil", "Listolier", weight=4) | |
311 G.add_edge("Blacheville", "Tholomyes", weight=4) | |
312 G.add_edge("Blacheville", "Listolier", weight=4) | |
313 G.add_edge("Blacheville", "Fameuil", weight=4) | |
314 G.add_edge("Favourite", "Tholomyes", weight=3) | |
315 G.add_edge("Favourite", "Listolier", weight=3) | |
316 G.add_edge("Favourite", "Fameuil", weight=3) | |
317 G.add_edge("Favourite", "Blacheville", weight=4) | |
318 G.add_edge("Dahlia", "Tholomyes", weight=3) | |
319 G.add_edge("Dahlia", "Listolier", weight=3) | |
320 G.add_edge("Dahlia", "Fameuil", weight=3) | |
321 G.add_edge("Dahlia", "Blacheville", weight=3) | |
322 G.add_edge("Dahlia", "Favourite", weight=5) | |
323 G.add_edge("Zephine", "Tholomyes", weight=3) | |
324 G.add_edge("Zephine", "Listolier", weight=3) | |
325 G.add_edge("Zephine", "Fameuil", weight=3) | |
326 G.add_edge("Zephine", "Blacheville", weight=3) | |
327 G.add_edge("Zephine", "Favourite", weight=4) | |
328 G.add_edge("Zephine", "Dahlia", weight=4) | |
329 G.add_edge("Fantine", "Tholomyes", weight=3) | |
330 G.add_edge("Fantine", "Listolier", weight=3) | |
331 G.add_edge("Fantine", "Fameuil", weight=3) | |
332 G.add_edge("Fantine", "Blacheville", weight=3) | |
333 G.add_edge("Fantine", "Favourite", weight=4) | |
334 G.add_edge("Fantine", "Dahlia", weight=4) | |
335 G.add_edge("Fantine", "Zephine", weight=4) | |
336 G.add_edge("Fantine", "Marguerite", weight=2) | |
337 G.add_edge("Fantine", "Valjean", weight=9) | |
338 G.add_edge("MmeThenardier", "Fantine", weight=2) | |
339 G.add_edge("MmeThenardier", "Valjean", weight=7) | |
340 G.add_edge("Thenardier", "MmeThenardier", weight=13) | |
341 G.add_edge("Thenardier", "Fantine", weight=1) | |
342 G.add_edge("Thenardier", "Valjean", weight=12) | |
343 G.add_edge("Cosette", "MmeThenardier", weight=4) | |
344 G.add_edge("Cosette", "Valjean", weight=31) | |
345 G.add_edge("Cosette", "Tholomyes", weight=1) | |
346 G.add_edge("Cosette", "Thenardier", weight=1) | |
347 G.add_edge("Javert", "Valjean", weight=17) | |
348 G.add_edge("Javert", "Fantine", weight=5) | |
349 G.add_edge("Javert", "Thenardier", weight=5) | |
350 G.add_edge("Javert", "MmeThenardier", weight=1) | |
351 G.add_edge("Javert", "Cosette", weight=1) | |
352 G.add_edge("Fauchelevent", "Valjean", weight=8) | |
353 G.add_edge("Fauchelevent", "Javert", weight=1) | |
354 G.add_edge("Bamatabois", "Fantine", weight=1) | |
355 G.add_edge("Bamatabois", "Javert", weight=1) | |
356 G.add_edge("Bamatabois", "Valjean", weight=2) | |
357 G.add_edge("Perpetue", "Fantine", weight=1) | |
358 G.add_edge("Simplice", "Perpetue", weight=2) | |
359 G.add_edge("Simplice", "Valjean", weight=3) | |
360 G.add_edge("Simplice", "Fantine", weight=2) | |
361 G.add_edge("Simplice", "Javert", weight=1) | |
362 G.add_edge("Scaufflaire", "Valjean", weight=1) | |
363 G.add_edge("Woman1", "Valjean", weight=2) | |
364 G.add_edge("Woman1", "Javert", weight=1) | |
365 G.add_edge("Judge", "Valjean", weight=3) | |
366 G.add_edge("Judge", "Bamatabois", weight=2) | |
367 G.add_edge("Champmathieu", "Valjean", weight=3) | |
368 G.add_edge("Champmathieu", "Judge", weight=3) | |
369 G.add_edge("Champmathieu", "Bamatabois", weight=2) | |
370 G.add_edge("Brevet", "Judge", weight=2) | |
371 G.add_edge("Brevet", "Champmathieu", weight=2) | |
372 G.add_edge("Brevet", "Valjean", weight=2) | |
373 G.add_edge("Brevet", "Bamatabois", weight=1) | |
374 G.add_edge("Chenildieu", "Judge", weight=2) | |
375 G.add_edge("Chenildieu", "Champmathieu", weight=2) | |
376 G.add_edge("Chenildieu", "Brevet", weight=2) | |
377 G.add_edge("Chenildieu", "Valjean", weight=2) | |
378 G.add_edge("Chenildieu", "Bamatabois", weight=1) | |
379 G.add_edge("Cochepaille", "Judge", weight=2) | |
380 G.add_edge("Cochepaille", "Champmathieu", weight=2) | |
381 G.add_edge("Cochepaille", "Brevet", weight=2) | |
382 G.add_edge("Cochepaille", "Chenildieu", weight=2) | |
383 G.add_edge("Cochepaille", "Valjean", weight=2) | |
384 G.add_edge("Cochepaille", "Bamatabois", weight=1) | |
385 G.add_edge("Pontmercy", "Thenardier", weight=1) | |
386 G.add_edge("Boulatruelle", "Thenardier", weight=1) | |
387 G.add_edge("Eponine", "MmeThenardier", weight=2) | |
388 G.add_edge("Eponine", "Thenardier", weight=3) | |
389 G.add_edge("Anzelma", "Eponine", weight=2) | |
390 G.add_edge("Anzelma", "Thenardier", weight=2) | |
391 G.add_edge("Anzelma", "MmeThenardier", weight=1) | |
392 G.add_edge("Woman2", "Valjean", weight=3) | |
393 G.add_edge("Woman2", "Cosette", weight=1) | |
394 G.add_edge("Woman2", "Javert", weight=1) | |
395 G.add_edge("MotherInnocent", "Fauchelevent", weight=3) | |
396 G.add_edge("MotherInnocent", "Valjean", weight=1) | |
397 G.add_edge("Gribier", "Fauchelevent", weight=2) | |
398 G.add_edge("MmeBurgon", "Jondrette", weight=1) | |
399 G.add_edge("Gavroche", "MmeBurgon", weight=2) | |
400 G.add_edge("Gavroche", "Thenardier", weight=1) | |
401 G.add_edge("Gavroche", "Javert", weight=1) | |
402 G.add_edge("Gavroche", "Valjean", weight=1) | |
403 G.add_edge("Gillenormand", "Cosette", weight=3) | |
404 G.add_edge("Gillenormand", "Valjean", weight=2) | |
405 G.add_edge("Magnon", "Gillenormand", weight=1) | |
406 G.add_edge("Magnon", "MmeThenardier", weight=1) | |
407 G.add_edge("MlleGillenormand", "Gillenormand", weight=9) | |
408 G.add_edge("MlleGillenormand", "Cosette", weight=2) | |
409 G.add_edge("MlleGillenormand", "Valjean", weight=2) | |
410 G.add_edge("MmePontmercy", "MlleGillenormand", weight=1) | |
411 G.add_edge("MmePontmercy", "Pontmercy", weight=1) | |
412 G.add_edge("MlleVaubois", "MlleGillenormand", weight=1) | |
413 G.add_edge("LtGillenormand", "MlleGillenormand", weight=2) | |
414 G.add_edge("LtGillenormand", "Gillenormand", weight=1) | |
415 G.add_edge("LtGillenormand", "Cosette", weight=1) | |
416 G.add_edge("Marius", "MlleGillenormand", weight=6) | |
417 G.add_edge("Marius", "Gillenormand", weight=12) | |
418 G.add_edge("Marius", "Pontmercy", weight=1) | |
419 G.add_edge("Marius", "LtGillenormand", weight=1) | |
420 G.add_edge("Marius", "Cosette", weight=21) | |
421 G.add_edge("Marius", "Valjean", weight=19) | |
422 G.add_edge("Marius", "Tholomyes", weight=1) | |
423 G.add_edge("Marius", "Thenardier", weight=2) | |
424 G.add_edge("Marius", "Eponine", weight=5) | |
425 G.add_edge("Marius", "Gavroche", weight=4) | |
426 G.add_edge("BaronessT", "Gillenormand", weight=1) | |
427 G.add_edge("BaronessT", "Marius", weight=1) | |
428 G.add_edge("Mabeuf", "Marius", weight=1) | |
429 G.add_edge("Mabeuf", "Eponine", weight=1) | |
430 G.add_edge("Mabeuf", "Gavroche", weight=1) | |
431 G.add_edge("Enjolras", "Marius", weight=7) | |
432 G.add_edge("Enjolras", "Gavroche", weight=7) | |
433 G.add_edge("Enjolras", "Javert", weight=6) | |
434 G.add_edge("Enjolras", "Mabeuf", weight=1) | |
435 G.add_edge("Enjolras", "Valjean", weight=4) | |
436 G.add_edge("Combeferre", "Enjolras", weight=15) | |
437 G.add_edge("Combeferre", "Marius", weight=5) | |
438 G.add_edge("Combeferre", "Gavroche", weight=6) | |
439 G.add_edge("Combeferre", "Mabeuf", weight=2) | |
440 G.add_edge("Prouvaire", "Gavroche", weight=1) | |
441 G.add_edge("Prouvaire", "Enjolras", weight=4) | |
442 G.add_edge("Prouvaire", "Combeferre", weight=2) | |
443 G.add_edge("Feuilly", "Gavroche", weight=2) | |
444 G.add_edge("Feuilly", "Enjolras", weight=6) | |
445 G.add_edge("Feuilly", "Prouvaire", weight=2) | |
446 G.add_edge("Feuilly", "Combeferre", weight=5) | |
447 G.add_edge("Feuilly", "Mabeuf", weight=1) | |
448 G.add_edge("Feuilly", "Marius", weight=1) | |
449 G.add_edge("Courfeyrac", "Marius", weight=9) | |
450 G.add_edge("Courfeyrac", "Enjolras", weight=17) | |
451 G.add_edge("Courfeyrac", "Combeferre", weight=13) | |
452 G.add_edge("Courfeyrac", "Gavroche", weight=7) | |
453 G.add_edge("Courfeyrac", "Mabeuf", weight=2) | |
454 G.add_edge("Courfeyrac", "Eponine", weight=1) | |
455 G.add_edge("Courfeyrac", "Feuilly", weight=6) | |
456 G.add_edge("Courfeyrac", "Prouvaire", weight=3) | |
457 G.add_edge("Bahorel", "Combeferre", weight=5) | |
458 G.add_edge("Bahorel", "Gavroche", weight=5) | |
459 G.add_edge("Bahorel", "Courfeyrac", weight=6) | |
460 G.add_edge("Bahorel", "Mabeuf", weight=2) | |
461 G.add_edge("Bahorel", "Enjolras", weight=4) | |
462 G.add_edge("Bahorel", "Feuilly", weight=3) | |
463 G.add_edge("Bahorel", "Prouvaire", weight=2) | |
464 G.add_edge("Bahorel", "Marius", weight=1) | |
465 G.add_edge("Bossuet", "Marius", weight=5) | |
466 G.add_edge("Bossuet", "Courfeyrac", weight=12) | |
467 G.add_edge("Bossuet", "Gavroche", weight=5) | |
468 G.add_edge("Bossuet", "Bahorel", weight=4) | |
469 G.add_edge("Bossuet", "Enjolras", weight=10) | |
470 G.add_edge("Bossuet", "Feuilly", weight=6) | |
471 G.add_edge("Bossuet", "Prouvaire", weight=2) | |
472 G.add_edge("Bossuet", "Combeferre", weight=9) | |
473 G.add_edge("Bossuet", "Mabeuf", weight=1) | |
474 G.add_edge("Bossuet", "Valjean", weight=1) | |
475 G.add_edge("Joly", "Bahorel", weight=5) | |
476 G.add_edge("Joly", "Bossuet", weight=7) | |
477 G.add_edge("Joly", "Gavroche", weight=3) | |
478 G.add_edge("Joly", "Courfeyrac", weight=5) | |
479 G.add_edge("Joly", "Enjolras", weight=5) | |
480 G.add_edge("Joly", "Feuilly", weight=5) | |
481 G.add_edge("Joly", "Prouvaire", weight=2) | |
482 G.add_edge("Joly", "Combeferre", weight=5) | |
483 G.add_edge("Joly", "Mabeuf", weight=1) | |
484 G.add_edge("Joly", "Marius", weight=2) | |
485 G.add_edge("Grantaire", "Bossuet", weight=3) | |
486 G.add_edge("Grantaire", "Enjolras", weight=3) | |
487 G.add_edge("Grantaire", "Combeferre", weight=1) | |
488 G.add_edge("Grantaire", "Courfeyrac", weight=2) | |
489 G.add_edge("Grantaire", "Joly", weight=2) | |
490 G.add_edge("Grantaire", "Gavroche", weight=1) | |
491 G.add_edge("Grantaire", "Bahorel", weight=1) | |
492 G.add_edge("Grantaire", "Feuilly", weight=1) | |
493 G.add_edge("Grantaire", "Prouvaire", weight=1) | |
494 G.add_edge("MotherPlutarch", "Mabeuf", weight=3) | |
495 G.add_edge("Gueulemer", "Thenardier", weight=5) | |
496 G.add_edge("Gueulemer", "Valjean", weight=1) | |
497 G.add_edge("Gueulemer", "MmeThenardier", weight=1) | |
498 G.add_edge("Gueulemer", "Javert", weight=1) | |
499 G.add_edge("Gueulemer", "Gavroche", weight=1) | |
500 G.add_edge("Gueulemer", "Eponine", weight=1) | |
501 G.add_edge("Babet", "Thenardier", weight=6) | |
502 G.add_edge("Babet", "Gueulemer", weight=6) | |
503 G.add_edge("Babet", "Valjean", weight=1) | |
504 G.add_edge("Babet", "MmeThenardier", weight=1) | |
505 G.add_edge("Babet", "Javert", weight=2) | |
506 G.add_edge("Babet", "Gavroche", weight=1) | |
507 G.add_edge("Babet", "Eponine", weight=1) | |
508 G.add_edge("Claquesous", "Thenardier", weight=4) | |
509 G.add_edge("Claquesous", "Babet", weight=4) | |
510 G.add_edge("Claquesous", "Gueulemer", weight=4) | |
511 G.add_edge("Claquesous", "Valjean", weight=1) | |
512 G.add_edge("Claquesous", "MmeThenardier", weight=1) | |
513 G.add_edge("Claquesous", "Javert", weight=1) | |
514 G.add_edge("Claquesous", "Eponine", weight=1) | |
515 G.add_edge("Claquesous", "Enjolras", weight=1) | |
516 G.add_edge("Montparnasse", "Javert", weight=1) | |
517 G.add_edge("Montparnasse", "Babet", weight=2) | |
518 G.add_edge("Montparnasse", "Gueulemer", weight=2) | |
519 G.add_edge("Montparnasse", "Claquesous", weight=2) | |
520 G.add_edge("Montparnasse", "Valjean", weight=1) | |
521 G.add_edge("Montparnasse", "Gavroche", weight=1) | |
522 G.add_edge("Montparnasse", "Eponine", weight=1) | |
523 G.add_edge("Montparnasse", "Thenardier", weight=1) | |
524 G.add_edge("Toussaint", "Cosette", weight=2) | |
525 G.add_edge("Toussaint", "Javert", weight=1) | |
526 G.add_edge("Toussaint", "Valjean", weight=1) | |
527 G.add_edge("Child1", "Gavroche", weight=2) | |
528 G.add_edge("Child2", "Gavroche", weight=2) | |
529 G.add_edge("Child2", "Child1", weight=3) | |
530 G.add_edge("Brujon", "Babet", weight=3) | |
531 G.add_edge("Brujon", "Gueulemer", weight=3) | |
532 G.add_edge("Brujon", "Thenardier", weight=3) | |
533 G.add_edge("Brujon", "Gavroche", weight=1) | |
534 G.add_edge("Brujon", "Eponine", weight=1) | |
535 G.add_edge("Brujon", "Claquesous", weight=1) | |
536 G.add_edge("Brujon", "Montparnasse", weight=1) | |
537 G.add_edge("MmeHucheloup", "Bossuet", weight=1) | |
538 G.add_edge("MmeHucheloup", "Joly", weight=1) | |
539 G.add_edge("MmeHucheloup", "Grantaire", weight=1) | |
540 G.add_edge("MmeHucheloup", "Bahorel", weight=1) | |
541 G.add_edge("MmeHucheloup", "Courfeyrac", weight=1) | |
542 G.add_edge("MmeHucheloup", "Gavroche", weight=1) | |
543 G.add_edge("MmeHucheloup", "Enjolras", weight=1) | |
544 return G |