cellcomplex.graph.interface.graph module¶
This module provide a set of graph concepts to form a graph interface
-
exception
cellcomplex.graph.interface.graph.GraphError[source]¶ Bases:
Exceptionbase class of all graph exceptions
-
class
cellcomplex.graph.interface.graph.ICopyGraph[source]¶ Bases:
objectallow the graph to be copied
-
class
cellcomplex.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
cellcomplex.graph.interface.graph.IExtendGraph[source]¶ Bases:
objectallow the graph to be extended by another graph
-
class
cellcomplex.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
-
edge_vertices(eid)[source]¶ retrieve the target and source of an edge
- Parameters
eid (eid) – id of the edge
- Return type
(vid,vid)
-
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
cellcomplex.graph.interface.graph.IMutableEdgeGraph[source]¶ Bases:
objectdefinition of graph edition methods for edges
-
class
cellcomplex.graph.interface.graph.IMutableVertexGraph[source]¶ Bases:
objectdefinition of graph edition methods for vertices
-
class
cellcomplex.graph.interface.graph.IRootedGraph[source]¶ Bases:
objectdefinition of graph with a root vertex.
-
property
root¶ Return the graph root.
- Returns
vertex identifier
-
property
-
class
cellcomplex.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
cellcomplex.graph.interface.graph.InvalidEdge[source]¶ Bases:
cellcomplex.graph.interface.graph.GraphError,KeyErrorexception raised when a wrong edge id is provided
-
exception
cellcomplex.graph.interface.graph.InvalidVertex[source]¶ Bases:
cellcomplex.graph.interface.graph.GraphError,KeyErrorexception raised when a wrong vertex id is provided