1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
.. _classes:
***********
Graph types
***********
NetworkX provides data structures and methods for storing graphs.
All NetworkX graph classes allow (hashable) Python objects as nodes
and any Python object can be assigned as an edge attribute.
The choice of graph class depends on the structure of the
graph you want to represent.
Which graph class should I use?
===============================
+----------------+------------+--------------------+------------------------+
| Networkx Class | Type | Self-loops allowed | Parallel edges allowed |
+================+============+====================+========================+
| Graph | undirected | Yes | No |
+----------------+------------+--------------------+------------------------+
| DiGraph | directed | Yes | No |
+----------------+------------+--------------------+------------------------+
| MultiGraph | undirected | Yes | Yes |
+----------------+------------+--------------------+------------------------+
| MultiDiGraph | directed | Yes | Yes |
+----------------+------------+--------------------+------------------------+
Basic graph types
=================
.. toctree::
:maxdepth: 2
graph
digraph
multigraph
multidigraph
.. note:: NetworkX uses `dicts` to store the nodes and neighbors in a graph.
So the reporting of nodes and edges for the base graph classes may not
necessarily be consistent across versions and platforms; however, the reporting
for CPython is consistent across platforms and versions after 3.6.
Graph Views
===========
.. automodule:: networkx.classes.graphviews
.. autosummary::
:toctree: generated/
generic_graph_view
subgraph_view
reverse_view
Core Views
==========
.. automodule:: networkx.classes.coreviews
.. autosummary::
:toctree: generated/
AtlasView
AdjacencyView
MultiAdjacencyView
UnionAtlas
UnionAdjacency
UnionMultiInner
UnionMultiAdjacency
FilterAtlas
FilterAdjacency
FilterMultiInner
FilterMultiAdjacency
Filters
=======
.. note:: Filters can be used with views to restrict the view (or expand it).
They can filter nodes or filter edges. These examples are intended to help
you build new ones. They may instead contain all the filters you ever need.
.. automodule:: networkx.classes.filters
.. autosummary::
:toctree: generated/
no_filter
hide_nodes
hide_edges
hide_diedges
hide_multidiedges
hide_multiedges
show_nodes
show_edges
show_diedges
show_multidiedges
show_multiedges
|