nngt.
Graph
(nodes=0, name='Graph', weighted=True, directed=True, from_graph=None, **kwargs)[source]The basic class that contains a graph_tool.Graph
and some
of is properties or methods to easily access them.
Initialize Graph instance
Parameters: |
|
---|---|
Returns: | self ( |
attributes
(edge=None, name=None)[source]Attributes of the graph’s edges.
Parameters: |
|
---|---|
Returns: |
|
edge_attribute
Access edge attributes
from_file
(filename, format='auto', delimiter=' ', secondary=';', attributes=None, notifier='@', ignore='#', from_string=False)[source]Import a saved graph from a file. @todo: implement population and shape loading, implement gml, dot, xml, gt
Parameters: |
|
---|---|
Returns: | graph ( |
from_library
(library_graph, weighted=True, directed=True, **kwargs)[source]from_matrix
(matrix, weighted=True, directed=True)[source]Creates a Graph
from a scipy.sparse
matrix or
a dense matrix.
Parameters: |
|
---|---|
Returns: |
get_attribute_type
(attribute_name)[source]Return the type of an attribute
get_betweenness
(btype='both', use_weights=False)[source]Betweenness centrality sequence of all nodes and edges.
Parameters: |
|
---|---|
Returns: |
|
get_degrees
(deg_type='total', node_list=None, use_weights=False)[source]Degree sequence of all the nodes.
Parameters: |
|
---|---|
Returns: |
|
get_delays
()[source]Returns the delay adjacency matrix as a
scipy.sparse.lil_matrix
if delays are present; else raises
an error.
get_density
()[source]Density of the graph: \(\frac{E}{N^2}\), where E is the number of edges and N the number of nodes.
get_edge_types
()[source]get_graph_type
()[source]Return the type of the graph (see nngt.generation)
get_name
()[source]Get the name of the graph
get_weights
()[source]Returns the weighted adjacency matrix as a
scipy.sparse.lil_matrix
.
graph_id
Unique int
identifying the instance.
is_directed
()[source]Whether the graph is directed or not
is_network
()[source]Whether the graph is a subclass of Network
(i.e. if it
has a NeuralPop
attribute).
is_spatial
()[source]Whether the graph is embedded in space (i.e. if it has a
Shape
attribute).
Returns True
is the graph is a subclass of
SpatialGraph
.
is_weighted
()[source]Whether the edges have weights
make_network
(graph, neural_pop, copy=False, **kwargs)[source]Turn a Graph
object into a Network
, or a
SpatialGraph
into a SpatialNetwork
.
Parameters: |
|
---|
Notes
In-place operation that directly converts the original graph if copy
is False
, else returns the copied Graph
turned into
a Network
.
make_spatial
(graph, shape, positions=None, copy=False)[source]Turn a Graph
object into a SpatialGraph
,
or a Network
into a SpatialNetwork
.
Parameters: |
|
---|
Notes
In-place operation that directly converts the original graph if copy
is False
, else returns the copied Graph
turned into
a SpatialGraph
.
name
Name of the graph.
node_attributes
Access node attributes
num_graphs
()[source]Returns the number of alive instances.
set_delays
(delay=None, elist=None, distribution=None, parameters=None, noise_scale=None)[source]Set the delay for spike propagation between neurons. ..todo :: take elist into account in Connections.delays
Parameters: |
|
---|
set_edge_attribute
(attribute, values=None, val=None, value_type=None, edges=None)[source]Set attributes to the connections between neurons.
Warning
The special “type” attribute cannot be modified when using graphs
that inherit from the Network
class. This is because
for biological networks, neurons make only one kind of synapse,
which is determined by the nngt.NeuralGroup
they
belong to.
set_name
(name='')[source]set graph name
set_types
(syn_type, nodes=None, fraction=None)[source]Set the synaptic/connection types.
Warning
The special “type” attribute cannot be modified when using graphs
that inherit from the Network
class. This is because
for biological networks, neurons make only one kind of synapse,
which is determined by the nngt.NeuralGroup
they
belong to.
Parameters: |
|
---|---|
Returns: | t_list ( |
set_weights
(weight=None, elist=None, distribution=None, parameters=None, noise_scale=None)[source]Set the synaptic weights.
Parameters: |
|
---|
to_file
(filename, format='auto', delimiter=' ', secondary=';', attributes=None, notifier='@')[source]Save graph to file; options detailed below.
See also
nngt.lib.save_to_file()
function for options.
type
Type of the graph.
nngt.
SpatialGraph
(nodes=0, name='Graph', weighted=True, directed=True, from_graph=None, shape=None, positions=None, **kwargs)[source]The detailed class that inherits from Graph
and implements
additional properties to describe spatial graphs (i.e. graph where the
structure is embedded in space.
Initialize SpatialClass instance. .. todo:: see what we do with the from_graph argument
Parameters: |
|
---|---|
Returns: | self ( |
get_positions
(neurons=None)[source]Returns the neurons’ positions as a (N, 2) array.
Parameters: | neurons (int or array-like, optional (default: all neurons)) – List of the neurons for which the position should be returned. |
---|
shape
nngt.
Network
(name='Network', weighted=True, directed=True, from_graph=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.
Initializes Network
instance.
Parameters: |
|
---|---|
Returns: | self ( |
ei_network
(size, ei_ratio=0.2, en_model='aeif_cond_alpha', en_param=None, es_model='static_synapse', es_param=None, in_model='aeif_cond_alpha', in_param=None, is_model='static_synapse', is_param=None)[source]Generate a network containing a population of two neural groups: inhibitory and excitatory neurons.
Parameters: |
|
---|---|
Returns: | net ( |
get_neuron_type
(neuron_ids)[source]Return the type of the neurons (+1 for excitatory, -1 for inhibitory).
Parameters: | neuron_ids (int or tuple) – NEST gids. |
---|---|
Returns: | ids (int or tuple) – Ids in the network. Same type as the requested gids type. |
id_from_nest_gid
(gids)[source]Return the ids of the nodes in the nngt.Network
instance from
the corresponding NEST gids.
Parameters: | gids (int or tuple) – NEST gids. |
---|---|
Returns: | ids (int or tuple) – Ids in the network. Same type as the requested gids type. |
nest_gid
neuron_properties
(idx_neuron)[source]Properties of a neuron in the graph.
Parameters: | idx_neuron (int) – Index of a neuron in the graph. |
---|---|
Returns: | dict of the neuron’s properties. |
num_networks
()[source]Returns the number of alive instances.
population
NeuralPop
that divides the neurons into groups with
specific properties.
set_types
(syn_type, nodes=None, fraction=None)[source]to_nest
(use_weights=True)[source]Send the network to NEST.
See also
make_nest_network()
for parameters
uniform_network
(size, neuron_model='aeif_cond_alpha', neuron_param=None, syn_model='static_synapse', syn_param=None)[source]Generate a network containing only one type of neurons.
Parameters: |
|
---|---|
Returns: | net ( |
nngt.
SpatialNetwork
(population, name='Graph', weighted=True, directed=True, shape=None, from_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.
Initialize Graph instance
Parameters: |
|
---|---|
Returns: | self ( |
set_types
(syn_type, nodes=None, fraction=None)[source]