This module provide a simple pure python implementation for a graph interface do not implement copy concept.
Bases: core.graph.interface.graph.IGraph, core.graph.interface.graph.IVertexListGraph, core.graph.interface.graph.IEdgeListGraph, core.graph.interface.graph.IMutableVertexGraph, core.graph.interface.graph.IMutableEdgeGraph, core.graph.interface.graph.IExtendGraph
Directed graph with multiple links in this implementation: - vertices are tuple of edge_in, edge_out - edges are tuple of source,target
add an edge to the graph, if eid is not provided create a new eid
Parameters: |
|
---|---|
Types: |
|
Returns: | the id of the newly created edge |
Return type: | eid |
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 |
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 |
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}) |
test wether an edge belong to the graph
Parameters: | eid (eid) -- edge id to test |
---|---|
Return type: | bool |
test wether a vertex belong to the graph
Parameters: | vid (vid) -- vertex id to test |
---|---|
Return type: | bool |
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 |
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 |
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 |
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 |
number of neighbors such as edges are directed from neighbor to vid
Parameters: | vid (vid) -- id of the reference vertex |
---|---|
Return type: | int |
number of neighbors regardless of the orientation of the edge
Parameters: | vid (vid) -- id of the reference vertex |
---|---|
Return type: | int |
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 |
number of neighbors such as edges are directed from vid to neighbor
Parameters: | vid (vid) -- id of the reference vertex |
---|---|
Return type: | int |
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 |
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 |
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 a specified edge from the graph
Parameters: | eid (eid) -- id of the edge to remove |
---|
remove a specified vertex of the graph remove all the edges attached to it
Parameters: | vid (vid) -- the id of the vertex to remove |
---|
retrieve the source of an edge
Parameters: | eid (eid) -- id of the edge |
---|---|
Return type: | vid |