graph_tool#

This is the core module providing the fundamental data structures and functions.

Fundamental classes#

Graph

General multigraph class.

GraphView

A view of selected vertices or edges of another graph.

Vertex

Vertex descriptor.

Edge

Edge descriptor.

Property Maps#

PropertyMap

This base class provides a mapping from vertices, edges or whole graphs to arbitrary properties.

VertexPropertyMap

This class provides a mapping from vertices to arbitrary properties.

EdgePropertyMap

This class provides a mapping from edges to arbitrary properties.

GraphPropertyMap

This class provides a mapping from graphs to arbitrary properties.

PropertyArray

This is a numpy.ndarray subclass which keeps a reference of its PropertyMap owner.

group_vector_property

Group list of properties props into a vector property map of the same type.

ungroup_vector_property

Ungroup vector property map vprop into a list of non-vector property maps.

map_property_values

Map the values of src_prop to tgt_prop according to the mapping function map_func.

infect_vertex_property

Propagate the prop values of vertices with value val to all their out-neighbors.

edge_endpoint_property

Return an edge property map corresponding to the vertex property prop of either the target and source of the edge, according to endpoint.

incident_edges_op

Return a vertex property map corresponding to a specific operation (sum, product, min or max) on the edge property eprop of incident edges on each vertex, following the direction given by direction.

perfect_prop_hash

Given a list of property maps props of the same type, a derived list of property maps with integral type htype is returned, where each value is replaced by a perfect (i.e. unique) hash value.

value_types

Return a list of possible properties value types.

Graph IO#

load_graph

Load a graph from file_name (which can be either a string or a file-like object).

load_graph_from_csv

Load a graph from a csv file containing a list of edges and edge properties.

OpenMP configuration#

openmp_enabled

Return True if OpenMP was enabled during compilation.

openmp_get_num_threads

Return the number of OpenMP threads.

openmp_set_num_threads

Set the number of OpenMP threads.

openmp_get_schedule

Return the runtime OpenMP schedule and chunk size.

openmp_set_schedule

Set the runtime OpenMP schedule and chunk size.

openmp_get_thresh

Return the minimum number of vertices necessary to enable parallelization.

openmp_set_thresh

Set the the minimum number of vertices necessary to enable parallelization.

System information#

show_config

Show graph_tool build configuration.