Warning
This section is not up to date anymore!
The Graph
class and its subclasses contain several attributes
regarding the properties of the edges and nodes. Edges attributes are contained
in the graph dictionary; more complex properties about the biological details
of the nodes/neurons are contained in the NeuralPop member of the
Graph
. These are briefly described in
Properties of graph components; a more detailed description is provided
here.
Usual graph libraries can store node and edge properties; as an example, many graphs are weighted and these weights can then be used to compute other properties such as weighted centralities, which is why it is interesting to have those properties stored in the basic graph library class.
The graph_object.py file contains the _GtEProperty
and _GtNProperty
classes which allow a generic interactions with the various libraries ways of
storing properties.
However, several problems occurs:
To get rid of those problems, the (possibly temporary) solution adopted is to
have the weights (synaptic strength) and types (inhibitory or excitatory)
attributes stored both in the graph library object and in the
Graph
container.
The libraries indices the edges in the order they are created; because of this,
weights must be added to the library using the edge list, which is stored
inside the Graph
container (access it through the ''edges''
key). The addition is performed in the following way: let
lil_matrix_attribute
contain the attribute of interest and network
be
the graph container to which we want to add the property, then the following
code is used,
sources, targets = network["edges"][:,0], network["edges"][:,1]
list_ordered_weights = lil_matrix_attribute[sources,targets].data[0]
network.graph.new_edge_attribute(
"weight", "double", values=list_ordered_weights)
This allows for fast graph filtering: we can keep only the edges or nodes we are interested in.
This property is invaluable if you want to study the graph properties of only the inhibitory network or look a the squeleton of the strongest synapses in the graph...
Note
This mixed format is not too good... I should either store everything in the container or in the library graph.