cellcomplex.graph.temporal_property_graph module¶
This module provide a class that extends the PropertyGraph with different types of edges
-
class
cellcomplex.graph.temporal_property_graph.TemporalPropertyGraph(graph=None, **kwds)[source]¶ Bases:
cellcomplex.graph.property_graph.PropertyGraphSimple implementation of PropertyGraph using dict as properties and two dictionaries to maintain these properties
-
STRUCTURAL= 's'¶
-
TEMPORAL= 't'¶
-
ancestors(vids, n=None)[source]¶ Return the 0, 1, …, nth ancestors of the vertex vid
- Parameters
vids : a set of vertex id
:Returns
anestors_list : the set of the 0, 1, …, nth ancestors of the vertex vid
-
append(graph, mapping=None, disable_lineage_checking=False)[source]¶ Append a (spatial) graph to the tpg structure with respect to a given temporal mapping.
-
children(vid)[source]¶ Return children of the vertex vid
- Parameters
vid : a vertex id
:Returns
children_list : the set of the children of the vertex vid
-
descendants(vids, n=None)[source]¶ Return the 0, 1, …, nth descendants of the vertex vid
- Parameters
vids : a set of vertex id
:Returns
descendant_list : the set of the 0, 1, …, nth descendant of the vertex vid
-
edge_property_at_time(edge_property, time_point)[source]¶ Return a subpart of graph.edge_property(edge_property) with relabelled key-pair into “images labelpairs” thanks to the dictionary graph.vertex_property(‘old_labels’).
- Parameters
vertex_property : str a string refering to an existing ‘graph.edge_property’ to extract;
time_point : int time-point for which to return the edge_property;
- Examples
graph.edge_property_with_image_labelpairs(‘wall_area’, 0)
-
edge_property_with_image_labelpairs(edge_property, time_point)[source]¶ Return a subpart of graph.edge_property(edge_property) with relabelled key-pair into “images labelpairs” thanks to the dictionary graph.vertex_property(‘old_labels’).
- Parameters
vertex_property : str a string refering to an existing ‘graph.edge_property’ to extract;
time_point : int time-point for which to return the edge_property;
- Examples
graph.edge_property_with_image_labelpairs(‘wall_area’, 0)
-
extend(graphs, mappings, time_steps=None, disable_lineage_checking=True)[source]¶ Extend the structure with graphs and mappings. Each graph contains structural edges. Mapping define dynamic edges between two graphs.
- Parameters
graphs - a list of PropertyGraph
mappings - a list defining the dynamic or temporal edges between two graphs.
time_steps - time corresponding to each graph
- Warning:
len(graphs) == len(mappings)-1
-
iter_ancestors(vids, n)[source]¶ Return the 0, 1, …, nth ancestors of the vertex vid
- Parameters
vids : a set of vertex id
:Returns
iterator : an iterator on the set of the 0, 1, …, nth ancestors of the vertex vid
-
iter_children(vid)[source]¶ Return children of the vertex vid
- Parameters
vid : a vertex id
:Returns
iterator : an iterator on the set of the children of the vertex vid
-
iter_descendants(vids, n=None)[source]¶ Return the 0, 1, …, nth descendants of the vertex vid
- Parameters
vids : a set of vertex id
:Returns
iterator : an iterator on the set of the 0, 1, …, nth descendants of the vertex vid
-
iter_parent(vid)[source]¶ Return parents of the vertex vid
- Parameters
vid : a vertex id
:Returns
iterator : the set of the children of the vertex vid
-
iter_sibling(vid)[source]¶ Return of the vertex vid
- Parameters
vid : a vertex id
:Returns
iterator : an iterator on the set of sibling of the vertex vid
-
lineaged_vertex(fully_lineaged=False, as_ancestor=False, as_descendant=False, lineage_rank=1)[source]¶ - Return ids of lineaged vertices, with differents type of lineage possible:
a full lineage, i.e. only vids with a lineage from the first to the last time-point (fully_lineaged=True);
a lineage over several ranks, i.e. only vids with a lineage from the vid to the vid+lineage_rank time-point (fully_lineaged=False, lineage_rank=int);
an ‘ancestors’ based lineage (as_ancestor = True), i.e. only vids lineaged as ancestor (over lineage_rank if not None);
an ‘descendants’ based lineage (as_ancestor = True), i.e. only vids lineaged as descendants (over lineage_rank if not None).
- Parameter
fully_lineaged (bool) : if True (and lineage_rank is None), return vertices lineaged from the first to the last time-point (or from vid_time_point to vid_time_point + lineage_rank), otherwise return vertices having at least a parent or a child(ren);
as_parent (bool) : if True, return vertices lineaged as parents;
as_children (bool) : if True, return vertices lineaged as children;
‘lineage_rank’ : int usefull if you want to check the lineage for a different rank than the rank-1 temporal neighborhood.
-
parent(vid)[source]¶ Return parents of the vertex vid
- Parameters
vid : a vertex id
:Returns
parents_list : the set of the parents of the vertex vid
-
rank_ancestors(vid, rank=1)[source]¶ - Return the ancestor of the vertex vid only at a given rank
- Parameters
vid : a vertex id or a set of vertex id
:Returns
descendant_list : the set of the rank-ancestor of the vertex vid or a list of set
-
rank_descendants(vid, rank=1)[source]¶ - Return the descendants of the vertex vid only at a given rank
- Parameters
vid : a vertex id or a set of vertex id
:Returns
descendant_list : the set of the rank-descendant of the vertex vid or a list of set
-
region_vids(region_name)[source]¶ Return a list of vids (TPG vertex id type) that belong to the region region_name according to graph. :Parameters:
region_name (str) : the name of a region (e.g. from self.add_vertex_to_region())
-
sibling(vid)[source]¶ Return sibling of the vertex vid
- Parameters
vid : a vertex id
:Returns
sibling_list : the set of sibling of the vertex vid
-
vertex_at_time(time_point, lineaged=False, fully_lineaged=False, as_ancestor=False, as_descendant=False, lineage_rank=1)[source]¶ Return vertices ids corresponding to a given time point in the TPG. Optional parameters can be used to filter the list of vertices ids returned.
- Parameters
time_point (int) : integer giving which time point should be considered;
lineaged (bool) : if True, return vertices having at least a parent or a child(ren);
‘lineage_rank’ : int usefull if you want to check the lineage for a different rank than the rank-1 temporal neighborhood;
fully_lineaged (bool) : if True, return vertices linked from the beginning to the end of the graph;
as_parent (bool) : if True, return vertices lineaged as parents;
as_children (bool) : if True, return vertices lineaged as children.
-
vertex_property_at_time(vertex_property, time_point, lineaged=False, fully_lineaged=False, as_ancestor=False, as_descendant=False, lineage_rank=1)[source]¶ Return the vertex_property``for a given `time_point. May be conditionned by extra temporal property: lineaged, fully_lineaged, as_parent, as_children.
- Parameters
vertex_property : str a string refering to an existing ‘graph.vertex_property’ to extract;
time_point (int) : integer giving which time point should be considered;
lineaged (bool) : if True, return vertices having at least a parent or a child(ren);
‘lineage_rank’ : int usefull if you want to check the lineage for a different rank than the rank-1 temporal neighborhood;
fully_lineaged (bool) : if True, return vertices linked from the beginning to the end of the graph;
as_parent (bool) : if True, return vertices lineaged as parents;
as_children (bool) : if True, return vertices lineaged as children.
-
vertex_property_with_image_labels(vertex_property, time_point, lineaged=False, fully_lineaged=False, as_ancestor=False, as_descendant=False, lineage_rank=1)[source]¶ Return a subpart of graph.vertex_property(vertex_property) with relabelled keys into “images labels” thanks to the dictionary graph.vertex_property(‘old_labels’). Since “images labels” can be similar (not unique), it is mandatory to give a time_point. Additional parameters can be given and are related to the ‘self.vertex_property_at_time’ parameters.
- Parameters
vertex_property : str a string refering to an existing ‘graph.vertex_property’ to extract;
time_point : int time-point for which to return the vertex_property;
lineaged (bool) : if True, return vertices having at least a parent or a child(ren);
‘lineage_rank’ : int usefull if you want to check the lineage for a different rank than the rank-1 temporal neighborhood;
fully_lineaged (bool) : if True, return vertices linked from the beginning to the end of the graph;
as_parent (bool) : if True, return vertices lineaged as parents;
as_children (bool) : if True, return vertices lineaged as children.
:Returns
-