graph_tool.rst 5.6 KB
Newer Older
1
.. automodule:: graph_tool
2
3
   :no-members:
   :no-undoc-members:
4

Tiago Peixoto's avatar
Tiago Peixoto committed
5
   .. autoclass:: Graph
6
7
    :no-members:
    :no-undoc-members:
8

9
    .. automethod:: copy
10

11
    .. container:: sec_title
12

13
       Iterating over vertices and edges
14

15
    See :ref:`sec_iteration` for more documentation and examples.
16

17
18
    Iterator-based interface:

19
20
    .. automethod:: vertices
    .. automethod:: edges
21

22
23
24
25
26
27
28
29
30
31
32
    Array-based interface:

    .. automethod:: get_vertices
    .. automethod:: get_edges
    .. automethod:: get_out_edges
    .. automethod:: get_in_edges
    .. automethod:: get_out_neighbours
    .. automethod:: get_in_neighbours
    .. automethod:: get_out_degrees
    .. automethod:: get_in_degrees

33
    .. container:: sec_title
34

35
       Obtaining vertex and edge descriptors
36

37
38
    .. automethod:: vertex
    .. automethod:: edge
39

40
    .. container:: sec_title
41

42
       Number of vertices and edges
43

44
45
    .. automethod:: num_vertices
    .. automethod:: num_edges
46

47
    .. container:: sec_title
48

49
       Modifying vertices and edges
50

51
52
    The following functions allow for addition and removal of
    vertices in the graph.
53

54
55
    .. automethod:: add_vertex
    .. automethod:: remove_vertex
56

57
58
    The following functions allow for addition and removal of
    edges in the graph.
59

60
61
    .. automethod:: add_edge
    .. automethod:: remove_edge
62
    .. automethod:: add_edge_list
63

64
65
    .. automethod:: set_fast_edge_removal
    .. automethod:: get_fast_edge_removal
Tiago Peixoto's avatar
Tiago Peixoto committed
66

Tiago Peixoto's avatar
Tiago Peixoto committed
67
    The following functions allow for easy removal of vertices and
68
    edges from the graph.
69

70
71
72
    .. automethod:: clear
    .. automethod:: clear_vertex
    .. automethod:: clear_edges
73

74
75
76
77
78
    After the removal of many edges and/or vertices, the underlying
    containers may have a capacity that significantly exceeds the size
    of the graph. The function below corrects this.
    
    .. automethod:: shrink_to_fit
79

80
    .. container:: sec_title
81

82
       Directedness and reversal of edges
83

84
    .. note::
85

86
       These functions do not actually modify the graph, and are fully
87
       reversible. They are also very cheap, with an :math:`O(1)`
88
       complexity.
89

90
91
    .. automethod:: set_directed
    .. automethod:: is_directed
92

93
94
    .. automethod:: set_reversed
    .. automethod:: is_reversed
95
96


97
    .. container:: sec_title
98

99
       Creation of new property maps
100

101
102
    .. automethod:: new_property
    .. automethod:: new_vertex_property
103
    .. automethod:: new_vp
104
    .. automethod:: new_edge_property
105
    .. automethod:: new_ep
106
    .. automethod:: new_graph_property
107
    .. automethod:: new_gp
108

109
110
    New property maps can be created by copying already existing
    ones.
111

112
    .. automethod:: copy_property
113

114
    .. automethod:: degree_property_map
115

116
    .. container:: sec_title
117

118
       Index property maps
119

120
121
    .. autoattribute:: vertex_index
    .. autoattribute:: edge_index
122
    .. autoattribute:: edge_index_range
123
    .. automethod:: reindex_edges
124

125
    .. container:: sec_title
126

127
       Internal property maps
128

129
130
131
132
    Internal property maps are just like regular property maps, with
    the only exception that they are saved and loaded to/from files
    together with the graph itself. See :ref:`internal property maps <sec_internal_props>`
    for more details.
133

134
    .. note::
135

136
137
138
139
140
141
       All dictionaries below are mutable. However, any dictionary
       returned below is only an one-way proxy to the internally-kept
       properties. If you modify this object, the change will be
       propagated to the internal dictionary, but not
       vice-versa. Keep this in mind if you intend to keep a copy of
       the returned object.
142

143
144
145
146
147
148
149
150
    .. autoattribute:: properties
    .. autoattribute:: vertex_properties
    .. autoattribute:: vp
    .. autoattribute:: edge_properties
    .. autoattribute:: ep
    .. autoattribute:: graph_properties
    .. autoattribute:: gp
    .. automethod:: list_properties
151
152


153
    .. container:: sec_title
154

155
       Filtering of vertices and edges.
156

157
    See :ref:`sec_graph_filtering` for more details.
158

159
    .. note::
160

161
162
163
       These functions do not actually modify the graph, and are fully
       reversible. They are also very cheap, and have an :math:`O(1)`
       complexity.
164

165
    .. automethod:: set_filters
166
167
168
169
    .. automethod:: set_vertex_filter
    .. automethod:: get_vertex_filter
    .. automethod:: set_edge_filter
    .. automethod:: get_edge_filter
170
    .. automethod:: clear_filters
171

172
    .. warning::
173

174
      The purge functions below irreversibly remove the filtered
175
176
177
      vertices or edges from the graph. Note that, contrary to the
      functions above, these are :math:`O(V)` and :math:`O(E)`
      operations, respectively.
178

179
180
    .. automethod:: purge_vertices
    .. automethod:: purge_edges
181

182
    .. container:: sec_title
183

184
       I/O operations
185

186
    See :ref:`sec_graph_io` for more details.
187

188
189
    .. automethod:: load
    .. automethod:: save
190
191
192



Tiago Peixoto's avatar
Tiago Peixoto committed
193
194
   .. autoclass:: GraphView
       :show-inheritance:
Tiago Peixoto's avatar
Tiago Peixoto committed
195
196
197
   .. autoclass:: Vertex
   .. autoclass:: Edge
   .. autoclass:: PropertyMap
Tiago Peixoto's avatar
Tiago Peixoto committed
198
199
   .. autoclass:: PropertyArray
       :show-inheritance:
Tiago Peixoto's avatar
Tiago Peixoto committed
200
       :no-members:
Tiago Peixoto's avatar
Tiago Peixoto committed
201
       :members: prop_map
Tiago Peixoto's avatar
Tiago Peixoto committed
202
   .. autofunction:: load_graph
203
   .. autofunction:: load_graph_from_csv
Tiago Peixoto's avatar
Tiago Peixoto committed
204
205
   .. autofunction:: group_vector_property
   .. autofunction:: ungroup_vector_property
Tiago Peixoto's avatar
Tiago Peixoto committed
206
   .. autofunction:: map_property_values
207
   .. autofunction:: infect_vertex_property
Tiago Peixoto's avatar
Tiago Peixoto committed
208
   .. autofunction:: edge_endpoint_property
Tiago Peixoto's avatar
Tiago Peixoto committed
209
210
   .. autofunction:: incident_edges_op
   .. autofunction:: perfect_prop_hash
Tiago Peixoto's avatar
Tiago Peixoto committed
211
212
213
   .. autofunction:: value_types
   .. autofunction:: show_config

Tiago Peixoto's avatar
Tiago Peixoto committed
214

215
216
217
218
Available subpackages
=====================

.. toctree::
219
   :maxdepth: 1
220

221
   centrality
222
   clustering
223
   collection
224
225
   correlations
   draw
226
   flow
Tiago Peixoto's avatar
Tiago Peixoto committed
227
   generation
228
   inference
Tiago Peixoto's avatar
Tiago Peixoto committed
229
   search_module
230
   spectral
231
   stats
Tiago Peixoto's avatar
Tiago Peixoto committed
232
   topology
233
   util