openalea.core.graph package#
Subpackages#
- openalea.core.graph.interface package
- Submodules
- openalea.core.graph.interface.graph module
- openalea.core.graph.interface.graphconcept module
CopyConceptEdgeListGraphConceptExtendConceptGraphConceptGraphErrorInexistingVertexInvalidEdgeInvalidGraphInvalidVertexMutableEdgeGraphConceptMutableVertexGraphConceptVertexListGraphConceptVertexListGraphConcept.in_neighbors()VertexListGraphConcept.nb_in_neighbors()VertexListGraphConcept.nb_neighbors()VertexListGraphConcept.nb_out_neighbors()VertexListGraphConcept.nb_vertices()VertexListGraphConcept.neighbors()VertexListGraphConcept.out_neighbors()VertexListGraphConcept.vertices()
- openalea.core.graph.interface.latticeconcept module
- openalea.core.graph.interface.port_graph module
IPortGraphIPortGraph.add_in_port()IPortGraph.add_out_port()IPortGraph.capacity()IPortGraph.connect()IPortGraph.disconnect()IPortGraph.in_port()IPortGraph.in_ports()IPortGraph.is_in_port()IPortGraph.is_out_port()IPortGraph.out_port()IPortGraph.out_ports()IPortGraph.port()IPortGraph.port_edges()IPortGraph.port_neighbors()IPortGraph.ports()IPortGraph.remove_port()IPortGraph.set_capacity()IPortGraph.source_port()IPortGraph.target_port()IPortGraph.vertex()
- openalea.core.graph.interface.property_graph module
- openalea.core.graph.interface.treeconcept module
- Module contents
Submodules#
openalea.core.graph.graph module#
This module provide a simple pure python implementation for a graph interface do not implement copy concept.
- class openalea.core.graph.graph.Graph(graph=None)[source]#
Bases:
IGraph,IVertexListGraph,IEdgeListGraph,IMutableVertexGraph,IMutableEdgeGraph,IExtendGraphDirected graph with multiple links in this implementation: - vertices are tuple of edge_in, edge_out - edges are tuple of source,target
- add_edge(edge=(None, None), eid=None)[source]#
add an edge to the graph, if eid is not provided create a new eid
- Parameters:
edge : a tuple (vertex source,vertex target)
eid : the id of the created edge
- Types:
edge : (vid,vid)
eid : eid
- Returns:
the id of the newly created edge
- Return type:
eid
- add_vertex(vid=None)[source]#
add a vertex to the graph, if vid is not provided create a new vid
- Parameters:
vid (vid) – the id of the vertex to add, default=None
- Returns:
the id of the created vertex
- Return type:
vid
- 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
- extend(graph)[source]#
add the specified graph to self, create new vid and eid
- Parameters:
graph (Graph) – the graph to add
- Returns:
two dictionnary specifying correspondence between graph id and self id
- Return type:
({vid:vid},{eid:eid})
- 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:
- 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
- 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_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
- 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_edges(vid)[source]#
number of edges linked to a specified vertex, oriented outside vertex
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- 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
- out_edges(vid)[source]#
retrieve the edges linked to a specified vertex, oriented outside the vertex
- Parameters:
vid (vid) – id of the reference vertex, default=None
- Return type:
iter of eid
- out_neighbors(vid)[source]#
iterator on the neighbors of vid where edges are directed from vid to neighbor
- Parameters:
vid (vid) – id of the reference vertex
- Return type:
iter of vid
- remove_edge(eid)[source]#
remove a specified edge from the graph
- Parameters:
eid (eid) – id of the edge to remove
- remove_vertex(vid)[source]#
remove a specified vertex of the graph remove all the edges attached to it
- Parameters:
vid (vid) – the id of the vertex to remove
- source(eid)[source]#
retrieve the source of an edge
- Parameters:
eid (eid) – id of the edge
- Return type:
vid
openalea.core.graph.id_generator module#
This module provide a generator for id numbers
openalea.core.graph.property_graph module#
This module provide a set of concepts to add properties to graph elements
- class openalea.core.graph.property_graph.PropertyGraph(graph=None)[source]#
Bases:
IPropertyGraph,Graphsimple implementation of IPropertyGraph using dict as properties and two dictionaries to maintain these properties
- 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
- extend(graph)[source]#
add the specified graph to self, create new vid and eid
- Parameters:
graph (Graph) – the graph to add
- Returns:
two dictionnary specifying correspondence between graph id and self id
- Return type:
({vid:vid},{eid:eid})
- remove_edge(eid)[source]#
remove a specified edge from the graph
- Parameters:
eid (eid) – id of the edge to remove
- remove_vertex(vid)[source]#
remove a specified vertex of the graph remove all the edges attached to it
- Parameters:
vid (vid) – the id of the vertex to remove