Core module

Core classes and functions. Most of them are not visible in the module as they are directly loaded at nngt level.

Content

nngt.core.GraphObject

alias of GtGraph

class nngt.core.IGraph(nodes=0, g=None, directed=True, parent=None)[source]

Bases: abc.Mock

Subclass of igraph.Graph.

__abstractmethods__ = frozenset([])
__init__(nodes=0, g=None, directed=True, parent=None)[source]
betweenness_list(use_weights=True, as_prop=False, norm=True)[source]
clear_all_edges()[source]

Remove all connections in the graph.

degree_list(node_list=None, deg_type='total', use_weights=True)[source]
edge_nb()[source]
new_edge(source, target, weight=1.0)[source]

Adding a connection to the graph, with optional properties.

Parameters:
  • source (int/node) – Source node.
  • target (int/node) – Target node.
  • weight (double, optional (default: 1.)) – Weight of the connection (synaptic strength with NEST).
Returns:

The new connection.

new_edges(edge_list, eprops=None)[source]

Adds a list of connections to the graph

new_node(n=1, ntype=1)[source]

Adding a node to the graph, with optional properties.

Parameters:
  • n (int, optional (default: 1)) – Number of nodes to add.
  • ntype (int, optional (default: 1)) – Type of neuron (1 for excitatory, -1 for inhibitory)
Returns:

The node or an iterator over the nodes created.

node_nb()[source]
remove_edge(edge)[source]
remove_vertex(node, fast=False)[source]
class nngt.core.GtGraph(nodes=0, g=None, directed=True, prune=False, vorder=None)[source]

Bases: abc.Mock

Subclass of graph_tool.Graph that (with SnapGraph) unifies the methods to work with either graph_tool or SNAP.

__abstractmethods__ = frozenset([])
__init__(nodes=0, g=None, directed=True, prune=False, vorder=None)[source]

@todo: document that see graph_tool.Graph‘s constructor

betweenness_list(use_weights=True, as_prop=False, norm=True)[source]
clear_all_edges()[source]
degree_list(node_list=None, deg_type='total', use_weights=True)[source]
edge_nb()[source]
new_edge(source, target, weight=1.0)[source]

Adding an edge to the graph, with optional properties.

Parameters:
  • source (int/node) – Source node.
  • target (int/node) – Target node.
  • weight (double, optional (default: 1.)) – Weight of the connection (synaptic strength with NEST).
Returns:

The new edge.

new_edges(edge_list, eprops=None)[source]

Adds a list of edges to the graph @todo: see how the eprops work

new_node(n=1, ntype=1)[source]

Adding a node to the graph, with optional properties.

Parameters:
  • n (int, optional (default: 1)) – Number of nodes to add.
  • ntype (int, optional (default: 1)) – Type of neuron (1 for excitatory, -1 for inhibitory)
Returns:

The node or an iterator over the nodes created.

node_nb()[source]
class nngt.core.NxGraph(nodes=0, g=None, directed=True)[source]

Bases: abc.Mock

Subclass of networkx Graph

__abstractmethods__ = frozenset([])
__init__(nodes=0, g=None, directed=True)[source]
betweenness_list(use_weights=True, as_prop=False)[source]
clear_all_edges()[source]

Remove all connections in the graph

degree_list(node_list=None, deg_type='total', use_weights=True)[source]
di_value = {'int': 0, 'double': 0.0, 'string': ''}
edge_nb()[source]
new_edge(source, target, weight=1.0)[source]

Adding a connection to the graph, with optional properties.

Parameters:
  • source (int/node) – Source node.
  • target (int/node) – Target node.
  • add_missing (bool, optional (default: None)) – Add the nodes if they do not exist.
  • weight (double, optional (default: 1.)) – Weight of the connection (synaptic strength with NEST).
Returns:

The new connection.

new_edge_attribute(name, value_type, values=None, val=None)[source]
new_edges(edge_list, eprops=None)[source]

Adds a list of connections to the graph

new_node(n=1, ntype=1)[source]

Adding a node to the graph, with optional properties.

Parameters:
  • n (int, optional (default: 1)) – Number of nodes to add.
  • ntype (int, optional (default: 1)) – Type of neuron (1 for excitatory, -1 for inhibitory)
Returns:

The node or an iterator over the nodes created.

new_node_attribute(name, value_type, values=None, val=None)[source]
node_nb()[source]
set_node_property()[source]