GraphGt

Module provides basic Graph interface to the graph_tool library.

class Graph(name=None, n_vertices=None, edges=None, directed=None, vertex_coordinates=None, vertex_radii=None, edge_coordinates=None, edge_radii=None, edge_geometries=None, shape=None, vertex_labels=None, edge_labels=None, annotation=None, base=None, edge_geometry_type='graph')[source]

Bases: ClearMap.Analysis.Graphs.Graph.AnnotatedGraph

Graph class to handle graph construction and analysis.

Note

This is a interface from ClearMap graphs to graph_tool.

add_edge(edge)[source]
add_edge_property(name, source=None, dtype=None)[source]
add_graph_property(name, source, dtype=None)[source]
add_vertex(n_vertices=None, vertex=None)[source]
add_vertex_property(name, source=None, dtype=None)[source]
annotate_properties(annotation, vertex_properties=None, edge_properties=None, edge_geometry_properties=None)[source]
axis_indices(axis=None, as_list=False)[source]
copy()[source]
define_edge_property(name, source, edge=None, dtype=None)[source]
define_graph_property(name, source, dtype=None)[source]
define_vertex_property(name, source, vertex=None, dtype=None)[source]
edge(edge)[source]
edge_annotation(edge=None)[source]
edge_close_binary(label, steps=1)[source]
edge_connectivity()[source]
edge_coordinates(edge=None)[source]
edge_dilate_binary(label, steps=1)[source]
edge_erode_binary(label, steps=1)[source]
edge_geometry(name='coordinates', edge=None, as_list=True, return_indices=False, reshape=True, ndim=None)[source]
edge_geometry_from_edge_property(edge_property_name, edge_geometry_name=None)[source]
edge_geometry_indices()[source]
edge_geometry_lengths(name='coordinates')[source]
edge_geometry_property(name)[source]
edge_geometry_property_name(name='coordinates', prefix='edge_geometry')[source]
edge_graph(return_edge_map=False)[source]
edge_index(edge)[source]
edge_indices()[source]
edge_iterator()[source]
edge_open_binary(label, steps=1)[source]
edge_propagate(label, value, steps=1)[source]
edge_property(name, edge=None, as_array=True)[source]
edge_property_map(name)[source]
edge_radii(edge=None)[source]
edge_source_label(vertex_label, as_array=True)[source]
edge_target_label(vertex_label, as_array=True)[source]
edge_to_vertex_label(edge_label, method='max', as_array=True)[source]
edge_to_vertex_label_or(edge_label)[source]
expand_vertex_filter(vertex_filter, steps=1)[source]
first_edge()[source]
first_vertex()[source]
graph_property(name)[source]
graph_property_map(name)[source]
has_edge_geometry(name='coordinates')[source]
info()[source]
is_edge_geometry_consistent(verbose=False)[source]
label_components(return_vertex_counts=False)[source]
largest_component(view=False)[source]
load(filename)[source]
remove_edge(edge)[source]
remove_edge_geometry(name=None)[source]
remove_edge_property(name)[source]
remove_graph_property(name)[source]
remove_isolated_edges()[source]
remove_isolated_vertices()[source]
remove_self_loops()[source]
remove_vertex(vertex)[source]
remove_vertex_property(name)[source]
resize_edge_geometry()[source]
save(filename)[source]
set_edge_annotation(annotation, edge=None, dtype='int32')[source]
set_edge_coordaintes(coordinates, edge=None)[source]
set_edge_geometry(name, values, indices=None, edge=None)[source]
set_edge_geometry_type(edge_geometry_type)[source]
set_edge_property(name, source, edge=None)[source]
set_edge_radii(radii, edge=None)[source]
set_graph_property(name, source)[source]
set_vertex_annotation(annotation, vertex=None, dtype='int32')[source]
set_vertex_coordinate(vertex, coordinate)[source]
set_vertex_coordinates(coordinates, vertex=None, dtype=<class 'float'>)[source]
set_vertex_property(name, source, vertex=None)[source]
set_vertex_radii(radii, vertex=None)[source]
set_vertex_radius(vertex, radius)[source]
sub_graph(vertex_filter=None, edge_filter=None, view=False)[source]
sub_slice(slicing, view=False, coordinates=None)[source]
sub_slice_edge_filter(slicing, coordinates=None)[source]
sub_slice_vertex_filter(slicing, coordinates=None)[source]
transform_properties(transformation, vertex_properties=None, edge_properties=None, edge_geometry_properties=None, verbose=False)[source]
vertex(vertex)[source]
vertex_annotation(vertex=None)[source]
vertex_close_binary(label, steps=1)[source]
vertex_coloring()[source]
vertex_coordinates(vertex=None, axis=None)[source]
vertex_degree(index)[source]
vertex_degrees()[source]
vertex_dilate_binary(label, steps=1)[source]
vertex_edges(vertex)[source]
vertex_edges_iterator(vertex)[source]
vertex_erode_binary(label, steps=1)[source]
vertex_in_degree(index)[source]
vertex_in_degrees()[source]
vertex_in_edges(vertex)[source]
vertex_in_edges_iterator(vertex)[source]
vertex_in_neighbours(index)[source]
vertex_index(vertex)[source]
vertex_indices()[source]
vertex_iterator()[source]
vertex_neighbours(index)[source]
vertex_open_binary(label, steps=1)[source]
vertex_out_degree(index)[source]
vertex_out_degrees()[source]
vertex_out_edges(vertex)[source]
vertex_out_edges_iterator(vertex)[source]
vertex_out_neighbours(index)[source]
vertex_propagate(label, value, steps=1)[source]
vertex_property(name, vertex=None, as_array=True)[source]
vertex_property_map(name)[source]
vertex_radii(vertex=None)[source]
vertex_to_edge_label(vertex_label, method=None)[source]
view(vertex_filter=None, edge_filter=None)[source]
property base
property directed
property edge_geometry_properties
property edge_geometry_property_names
property edge_geometry_type

Type for storing edge properties

Returns

type‘graph’ or ‘edge’
‘graph’Stores edge coordinates in an graph property array and

start end indices in edges.

‘edge’Stores the edge coordinates in variable length vectors in

each edge.

property edge_properties
property edges
property graph_properties
property has_edge_coordinates
property has_edge_radii
property has_vertex_coordinates
property has_vertex_radii
property is_view
property n_edges

Number of edges in the graph.

property n_vertices

Number of vertices in the graph.

property ndim
property shape

The shape of the space in which the graph is embedded.

Returns

shapetuple of int

The shape of the graph space.

property vertex_properties
property vertices
dtype_to_gtype(dtype)[source]

Convert a data type to a graph_tool data type.

edge_property_map_from_python(source, graph, dtype=None)[source]

Create a edge property map from a python source.

edge_property_map_to_python(property_map, as_array=True)[source]

Convert edge property map to a python array or list.

gtype_from_source(source, vectorize=True, graph_property=False)[source]

Determines the graph_tool data type from a data source.

load(filename)[source]
ndim_from_source(source)[source]

Determines the dimension of a source appropiate for graph_tool.

ndim_to_gtype(ndim, gtype)[source]

Convert a scalar gtype to a vector one if necessary.

pickler(stream, obj)[source]
save(filename, graph)[source]
set_edge_property_map(property_map, source)[source]

Set values for edge property map.

set_vertex_property_map(property_map, source)[source]

Set values for vertex property map.

unpickler(stream)[source]
vertex_property_map_from_python(source, graph, dtype=None)[source]

Create a vertex property map from a python source.

vertex_property_map_to_python(property_map, as_array=True)[source]

Convert vertex property map to a python array or list.