
NetworkX Reference Release 2.6.2 Aric Hagberg, Dan Schult, Pieter Swart Jul 27, 2021 CONTENTS 1 Introduction 1 1.1 NetworkX Basics ............................................. 1 1.2 Graphs .................................................. 2 1.3 Graph Creation .............................................. 3 1.4 Graph Reporting ............................................. 3 1.5 Algorithms ................................................ 4 1.6 Drawing .................................................. 4 1.7 Data Structure .............................................. 5 2 Graph types 7 2.1 Which graph class should I use? ..................................... 7 2.2 Basic graph types ............................................. 7 2.3 Graph Views ............................................... 139 2.4 Core Views ................................................ 141 2.5 Filters ................................................... 148 3 Algorithms 151 3.1 Approximations and Heuristics ...................................... 151 3.2 Assortativity ............................................... 174 3.3 Asteroidal ................................................. 186 3.4 Bipartite ................................................. 187 3.5 Boundary ................................................. 225 3.6 Bridges .................................................. 226 3.7 Centrality ................................................. 229 3.8 Chains .................................................. 270 3.9 Chordal .................................................. 271 3.10 Clique ................................................... 276 3.11 Clustering ................................................. 280 3.12 Coloring ................................................. 286 3.13 Communicability ............................................. 290 3.14 Communities ............................................... 292 3.15 Components ............................................... 305 3.16 Connectivity ............................................... 322 3.17 Cores ................................................... 355 3.18 Covering ................................................. 360 3.19 Cycles ................................................... 362 3.20 Cuts .................................................... 366 3.21 D-Separation ............................................... 371 3.22 Directed Acyclic Graphs ......................................... 372 3.23 Distance Measures ............................................ 382 i 3.24 Distance-Regular Graphs ......................................... 386 3.25 Dominance ................................................ 389 3.26 Dominating Sets ............................................. 391 3.27 Efficiency ................................................. 392 3.28 Eulerian .................................................. 394 3.29 Flows ................................................... 398 3.30 Graph Hashing .............................................. 427 3.31 Graphical degree sequence ........................................ 429 3.32 Hierarchy ................................................. 433 3.33 Hybrid .................................................. 433 3.34 Isolates .................................................. 435 3.35 Isomorphism ............................................... 437 3.36 Link Analysis ............................................... 457 3.37 Link Prediction .............................................. 465 3.38 Lowest Common Ancestor ........................................ 473 3.39 Matching ................................................. 475 3.40 Minors .................................................. 478 3.41 Maximal independent set ......................................... 486 3.42 non-randomness ............................................. 487 3.43 Moral ................................................... 488 3.44 Node Classification ............................................ 488 3.45 Operators ................................................. 491 3.46 Planarity ................................................. 502 3.47 Planar Drawing .............................................. 507 3.48 Reciprocity ................................................ 507 3.49 Regular .................................................. 508 3.50 Rich Club ................................................. 510 3.51 Shortest Paths ............................................... 511 3.52 Similarity Measures ............................................ 551 3.53 Simple Paths ............................................... 561 3.54 Small-world ................................................ 567 3.55 s metric .................................................. 570 3.56 Sparsifiers ................................................. 571 3.57 Structural holes .............................................. 572 3.58 Summarization .............................................. 575 3.59 Swap ................................................... 579 3.60 Threshold Graphs ............................................. 581 3.61 Tournament ................................................ 582 3.62 Traversal ................................................. 585 3.63 Tree .................................................... 601 3.64 Triads ................................................... 617 3.65 Vitality .................................................. 620 3.66 Voronoi cells ............................................... 621 3.67 Wiener index ............................................... 622 4 Functions 625 4.1 Graph ................................................... 625 4.2 Nodes ................................................... 634 4.3 Edges ................................................... 636 4.4 Self loops ................................................. 637 4.5 Attributes ................................................. 639 4.6 Paths ................................................... 644 4.7 Freezing graph structure ......................................... 645 ii 5 Graph generators 647 5.1 Atlas ................................................... 647 5.2 Classic .................................................. 649 5.3 Expanders ................................................. 658 5.4 Lattice .................................................. 660 5.5 Small ................................................... 663 5.6 Random Graphs ............................................. 668 5.7 Duplication Divergence .......................................... 680 5.8 Degree Sequence ............................................. 682 5.9 Random Clustered ............................................ 688 5.10 Directed ................................................. 689 5.11 Geometric ................................................ 693 5.12 Line Graph ................................................ 701 5.13 Ego Graph ................................................ 703 5.14 Stochastic ................................................. 704 5.15 AS graph ................................................. 705 5.16 Intersection ................................................ 705 5.17 Social Networks ............................................. 707 5.18 Community ................................................ 709 5.19 Spectral .................................................. 719 5.20 Trees ................................................... 720 5.21 Non Isomorphic Trees .......................................... 723 5.22 Triads ................................................... 723 5.23 Joint Degree Sequence .......................................... 724 5.24 Mycielski ................................................. 728 5.25 Harary Graph ............................................... 729 5.26 Cographs ................................................. 731 5.27 Interval Graph .............................................. 732 5.28 Sudoku .................................................. 733 6 Linear algebra 735 6.1 Graph Matrix ............................................... 735 6.2 Laplacian Matrix ............................................. 737 6.3 Bethe Hessian Matrix ........................................... 740 6.4 Algebraic Connectivity .......................................... 741 6.5 Attribute Matrices ............................................ 744 6.6 Modularity Matrices ........................................... 747 6.7 Spectrum ................................................. 750 7 Converting to and from other data formats 753 7.1 To NetworkX Graph ........................................... 753 7.2 Dictionaries ................................................ 754 7.3 Lists .................................................... 756 7.4 Numpy .................................................. 758 7.5 Scipy ................................................... 765 7.6 Pandas .................................................. 768 8 Relabeling nodes 775 8.1 Relabeling ................................................ 775 9 Reading and writing graphs 779 9.1 Adjacency List .............................................. 779 9.2 Multiline Adjacency List ......................................... 783 9.3 Edge List ................................................. 786 9.4 GEXF ................................................... 793 iii 9.5 GML ................................................... 796 9.6 Pickle ................................................... 801 9.7
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages953 Page
-
File Size-