openalea.core.graph.interface package#
Submodules#
openalea.core.graph.interface.graph module#
This module provide a set of graph concepts to form a graph interface
- exception openalea.core.graph.interface.graph.GraphError[source]#
Bases:
Exceptionbase class of all graph exceptions
- class openalea.core.graph.interface.graph.ICopyGraph[source]#
Bases:
objectallow the graph to be copied
- class openalea.core.graph.interface.graph.IEdgeListGraph[source]#
Bases:
objectDefinition of a graph seen as a list of edges
- edges(vid=None)[source]#
retrieve the edges linked to a specified vertex, all if vid is None
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- in_edges(vid)[source]#
retrieve the edges linked to a specified vertex, oriented inside the vertex
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- nb_edges(vid=None)[source]#
number of edges linked to a specified vertex, total number if vid is None
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- nb_in_edges(vid)[source]#
number of edges linked to a specified vertex, oriented inside vertex
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- class openalea.core.graph.interface.graph.IExtendGraph[source]#
Bases:
objectallow the graph to be extended by another graph
- class openalea.core.graph.interface.graph.IGraph[source]#
Bases:
objectDirected graph definition
- edge(source, target)[source]#
find the matching edges with same source and same target return None if it don’t succeed
- Parameters:
source : id of the source vertex
target : id of the target vertex
- Types:
source : vid
target : vid
- Return type:
eid|iter of eid|None
- has_edge(eid)[source]#
test wether an edge belong to the graph
- Parameters:
eid (eid) – edge id to test
- Return type:
- has_vertex(vid)[source]#
test wether a vertex belong to the graph
- Parameters:
vid (vid) – vertex id to test
- Return type:
- class openalea.core.graph.interface.graph.IMutableEdgeGraph[source]#
Bases:
objectdefinition of graph edition methods for edges
- class openalea.core.graph.interface.graph.IMutableVertexGraph[source]#
Bases:
objectdefinition of graph edition methods for vertices
- class openalea.core.graph.interface.graph.IVertexListGraph[source]#
Bases:
objectinterface of a graph seen as a vertex list
- in_neighbors(vid)[source]#
iterator on the neighbors of vid where edges are directed from neighbor to vid
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
iter of vid
- nb_in_neighbors(vid)[source]#
number of neighbors such as edges are directed from neighbor to vid
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
- nb_neighbors(vid)[source]#
number of neighbors regardless of the orientation of the edge
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
- nb_out_neighbors(vid)[source]#
number of neighbors such as edges are directed from vid to neighbor
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
- neighbors(vid)[source]#
iterator on the neighbors of vid regardless of the orientation of the edge
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
iter of vid
- exception openalea.core.graph.interface.graph.InvalidEdge[source]#
Bases:
GraphError,KeyErrorexception raised when a wrong edge id is provided
- exception openalea.core.graph.interface.graph.InvalidVertex[source]#
Bases:
GraphError,KeyErrorexception raised when a wrong vertex id is provided
openalea.core.graph.interface.graphconcept module#
A graph Interface.
- class openalea.core.graph.interface.graphconcept.EdgeListGraphConcept[source]#
Bases:
GraphConceptEdge List Graph Concept
- class openalea.core.graph.interface.graphconcept.ExtendConcept[source]#
Bases:
objectExtend the actul data structure with an other.
- class openalea.core.graph.interface.graphconcept.GraphConcept[source]#
Bases:
objectGraph concept or graph interface. To separate algo and data structures.
- edge(source, target)[source]#
Return the edge identifier or an iterator if the graph is a multiplegraph.
- Parameters:
source: vtx_id
target: vtx_id
- Return:
iter of edge_id
- has_edge(edge_id)[source]#
Test the existence of an edge in the graph.
- Parameters:
edge_id: The edge identifier.
- Return:
bool
- has_vertex(vtx_id)[source]#
Test the existence of a vertex in the graph.
- Parameters:
vtx_id: The vertex identifier.
- Return:
bool
- exception openalea.core.graph.interface.graphconcept.InexistingVertex[source]#
Bases:
GraphErrortodo
- exception openalea.core.graph.interface.graphconcept.InvalidEdge[source]#
Bases:
GraphError,KeyErrortodo
- exception openalea.core.graph.interface.graphconcept.InvalidGraph[source]#
Bases:
GraphErrortodo
- exception openalea.core.graph.interface.graphconcept.InvalidVertex[source]#
Bases:
GraphError,KeyErrortodo
- class openalea.core.graph.interface.graphconcept.MutableEdgeGraphConcept[source]#
Bases:
EdgeListGraphConceptMutable Edge Graph Concept.
- class openalea.core.graph.interface.graphconcept.MutableVertexGraphConcept[source]#
Bases:
VertexListGraphConceptMutable Vertex Graph Concept
- class openalea.core.graph.interface.graphconcept.VertexListGraphConcept[source]#
Bases:
GraphConceptVertex List Graph Concept.
openalea.core.graph.interface.latticeconcept module#
Lattice Interface
- class openalea.core.graph.interface.latticeconcept.Container[source]#
Bases:
objectContainer Interface (tree, graph or other data structure)
- class openalea.core.graph.interface.latticeconcept.MultiscaleContainer[source]#
Bases:
ScaleLattice,ContainerA multiscale container interface. seid= (eid,sid) seid: scale and element identifier
- complex(seid, sid)[source]#
Return the complex of the component seid at the scale sid
- Parameters:
seid: the component scale and element identifier
sid: the complex scale identifier
- Return:
seid
- components(seid, sid)[source]#
Return the components of the complex seid at the scale sid
- Parameters:
seid: the complex scale and element identifier
sid: the components scale identifier
- Return:
iter of seid
- container(sid)[source]#
Return a ref on the container associated to sid.
- Parameters:
sid: scale identifier
- Return:
container (a reference, not a copy)
- class openalea.core.graph.interface.latticeconcept.MultiscaleTree[source]#
Bases:
MultiscaleContainerA MultiscaleTree interface.
- class openalea.core.graph.interface.latticeconcept.MutableMultiscaleContainer[source]#
Bases:
MutableScaleLattice,MultiscaleContainerInterface of a mutable MultiscaleContainer
- class openalea.core.graph.interface.latticeconcept.MutableMultiscaleTree[source]#
Bases:
MutableMultiscaleContainer,MultiscaleTreeA mutable MultiscaleTree
- class openalea.core.graph.interface.latticeconcept.MutableScaleLattice[source]#
Bases:
ScaleLatticeA mutable scale lattice. (sic)
- add_scale(sid, min_id, max_id)[source]#
Add a scale sid between min_id and max_id. If min_id is coarsest(), add sid after coarsest If max_id is finest() then add sid before finest Else add sid between min_id and max_id
- Parameters:
sid: the scale identifier to add
min_id: finer scale identifier
max_id: coarser scale identifier
- class openalea.core.graph.interface.latticeconcept.ScaleLattice[source]#
Bases:
objecttodo
- coarser(sid)[source]#
Return the coarser scales of sid
- Parameters:
sid: scale identifier
- Return:
iter of scale_id
- finer(sid)[source]#
Return the coarser scales of sid
- Parameters:
sid: scale identifier
- Return:
iter of scale_id
- max(sid1, sid2)[source]#
Return the finer scale of common coarser scales of sid1 and sid2
- Parameters:
sid1: scale identifier
sid2: scale identifier
- Return:
a scale identifier
openalea.core.graph.interface.port_graph module#
This module provide a set of concepts to add properties to graph elements
openalea.core.graph.interface.property_graph module#
This module provide a set of concepts to add properties to graph elements
- class openalea.core.graph.interface.property_graph.IPropertyGraph[source]#
Bases:
objectDirected graph with properties associated with edges and vertices Properties may not be defined on all elements Properties may be empty on some elements A property is a map between an element id (vid or eid) and a data
- add_edge_property(property_name)[source]#
add a new map between eid and a data do not fill this property for any edge
- add_vertex_property(property_name)[source]#
add a new map between vid and a data do not fill this property for any vertex
- edge_property(property_name)[source]#
return a map between eid and data for all edges where property_name is defined
- Return type:
dict of
{eid:data}
- edge_property_names()[source]#
iter on names of all property maps defined on edge return iter of keys
openalea.core.graph.interface.treeconcept module#
Tree Concept.
- class openalea.core.graph.interface.treeconcept.EditableTreeConcept[source]#
Bases:
MutableTreeConcept- add_child_tree(parent, tree)[source]#
Add a tree after the children of the parent vertex. Complexity have to be O(1) if tree == sub_tree()
- Parameters:
parent – vertex identifier
tree – a rooted tree
- class openalea.core.graph.interface.treeconcept.MutableTreeConcept[source]#
Bases:
RootedTreeConcept,MutableVertexGraphConceptA mutable rooted tree. The substitute method is defined outside the interface. substitute(self,vid,tree)
- add_child(parent, child)[source]#
Add a child at the end of children
- Parameters:
parent – The parent identifier.
child – The child identifier.
- class openalea.core.graph.interface.treeconcept.OrderedTreeConcept[source]#
Bases:
RootedTreeConceptAn ordered tree is a rooted tree where an order relation is defined between chidren.
- first_child(vid)[source]#
Return the first child of vid
- Parameters:
vid – The vertex identifier.
- Returns:
vid
- last_child(vid)[source]#
Return the last child of vid
- Parameters:
vid – The vertex identifier.
- Returns:
vid
- class openalea.core.graph.interface.treeconcept.RootedTreeConcept[source]#
Bases:
VertexListGraphConceptRooted Tree interface.
depth(vid), depth() and sub_tree(vid) can be extenal algorithms.
- children(vtx_id)[source]#
Return a vertex iterator
- Parameters:
vtx_id – The vertex identifier.
- Returns:
iter of vertex identifier
- nb_children(vtx_id)[source]#
Return the number of children
- Parameters:
vtx_id – The vertex identifier.
- Return type:
- parent(vtx_id)[source]#
Return the parent of vtx_id.
- Parameters:
vtx_id – The vertex identifier.
- Returns:
vertex identifier
- property root#
Return the tree root.
- Returns:
vertex identifier