Graph container classesΒΆ

class nngt.Graph(nodes=0, name='Graph', weighted=True, directed=True, libgraph=None, **kwargs)[source]

The basic class that contains a graph_tool.Graph and some of is properties or methods to easily access them.

Variables:
  • idint unique id that identifies the instance.
  • graphGraphObject main attribute of the class instance.
add_edges(lst_edges)[source]

Add a list of edges to the graph.

Parameters:
  • lst_edges (list of 2-tuples or np.array of shape (edge_nb, 2)) – List of the edges that should be added as tuples (source, target)
  • @todo (add example, check the edges for self-loops and multiple edges)
adjacency_matrix(weighted=True)[source]
attributes()[source]
copy()[source]

Returns a deepcopy of the current Graph instance

edge_nb()[source]
excitatory_subgraph()[source]

create a Graph instance which graph contains only the excitatory edges of the current instance’s GraphObject

get_betweenness(use_weights=True)[source]
get_degrees(strType='total', use_weights=True)[source]
get_density()[source]
get_edge_types()[source]
get_name()[source]
get_properties(a_properties)[source]

Return a dictionary containing the desired properties

Parameters:a_properties (sequence) – List or tuple of strings of the property names.
Returns:di_result (dict) – A dictionary of values with the property names as keys.
get_property(s_property)[source]

Return the desired property or None for an incorrect one.

get_weights()[source]
graph

graph_tool.Graph attribute of the instance

id

unique int identifying the instance

inhibitory_subgraph()[source]

Create a Graph instance which graph contains only the inhibitory edges of the current instance’s graph_tool.Graph

is_directed()[source]
is_spatial()[source]
is_weighted()[source]
name
node_nb()[source]
classmethod num_graphs()[source]

Returns the number of alive instances.

set_name(name='')[source]

set graph name

set_weights(elist=None, wlist=None, distrib=None, distrib_prop=None, correl=None, noise_scale=None)[source]

Set the synaptic weights.

Parameters:
  • elist (class:numpy.array, optional (default: None)) – List of the edges (for user defined weights).
  • wlist (class:numpy.array, optional (default: None)) – List of the weights (for user defined weights).
  • distrib (class:string, optional (default: None)) – Type of distribution (choose among “constant”, “uniform”, “gaussian”, “lognormal”, “lin_corr”, “log_corr”).
  • distrib_prop (dict, optional (default: {})) – Dictoinary containing the properties of the weight distribution.
  • correl (class:string, optional (default: None)) – Property to which the weights should be correlated.
  • noise_scale (class:int, optional (default: None)) – Scale of the multiplicative Gaussian noise that should be applied on the weights.
class nngt.SpatialGraph(nodes=0, name='Graph', weighted=True, directed=True, libgraph=None, shape=None, positions=None, **kwargs)[source]

The detailed class that inherits from Graph and implements additional properties to describe various biological functions and interact with the NEST simulator.

Variables:
  • shapeShape Shape of the neurons environment.
  • positionsnumpy.array Positions of the neurons.
  • graphGraphObject Main attribute of the class instance.
classmethod make_spatial(graph, shape=<nngt.core.graph_datastruct.Shape instance>, positions=None)[source]
shape
class nngt.Network(name='Graph', weighted=True, directed=True, libgraph=None, population=None, **kwargs)[source]

The detailed class that inherits from Graph and implements additional properties to describe various biological functions and interact with the NEST simulator.

Variables:
  • neural_modellist List of the NEST neural models for each neuron.
  • syn_modellist List of the NEST synaptic models for each edge.
  • graphGraphObject Main attribute of the class instance
classmethod ei_network(size, ei_ratio=0.2, en_model='aeif_neuron', en_param={}, es_model='static_synapse', es_param={}, in_model='aeif_neuron', in_param={}, is_model='static_synapse', is_param={})[source]
classmethod make_network(graph, neural_pop)[source]
neuron_properties(idx_neuron)[source]
classmethod num_networks()[source]

Returns the number of alive instances.

population
classmethod uniform_network(size, neuron_model='iaf_neuron', neuron_param={}, syn_model='static_synapse', syn_param={})[source]
class nngt.SpatialNetwork(population, name='Graph', weighted=True, directed=True, shape=None, graph=None, positions=None, **kwargs)[source]

Class that inherits from Network and SpatialGraph to provide a detailed description of a real neural network in space, i.e. with positions and biological properties to interact with NEST.

Variables:
  • shapenngt.core.Shape Shape of the neurons environment.
  • positionsnumpy.array Positions of the neurons.
  • neural_modellist List of the NEST neural models for each neuron.
  • syn_modellist List of the NEST synaptic models for each edge.
  • graphGraphObject Main attribute of the class instance.