Enable setting vertex and edge properties in NetworkGroup
Currently, the NetworkGroup is not capable of setting vertex and edge properties from the corresponding containers in the group. This, however, would be a very useful feature to have.
Proposal
Implement the following functions in the NetworkGroup:
set_node_properties(self, g: nx.Graph, at_time: int=None)set_edge_properties(self, g: nx.Graph, at_time: int=None)set_node_property(self, g: nx.Graph, name:str, at_time: int=None)set_edge_property(self, g: nx.Graph, name:str, at_time: int=None)
Remarks:
- The
NetworkGroupknows which containers are node or edge properties through theis_node/edge_attributeattribute. - It should be possible to set properties for only one specific time step. If the time is not given, the node/edge should contain an array with the values for all times. This is up for discussion, I guess.
- In the
create_graphfunction, it should be possible to directly set node or edge properties.
An issue will be to set the correct property to the correct node/edge in the case of unordered containers. To solve this, nodes and edges should be set using an id, if provided, which unambiguously connects them to a property.
How to test the implementation?
Write tests to check if the node and edge properties are set.