|
Methods defined here:
- __init__(self, directed=False)
- Initialize self. See help(type(self)) for accurate signature.
- __repr__ = __str__(self)
- __str__(self)
- Return str(self).
- degree(self, v, outgoing=True)
- returns degree of a vertex in graph, O(1)
:param v: vertex
:param outgoing: graph type
:return: degree (integer)
- edge_count(self)
- edges(self)
- Never used, so don't mind the forbidden apple in form of set()
:return:
- get_edge(self, u, v)
- O(1) brought to you by the power of hash map
:param u: vertex 1
:param v: vertex 2
:return: edge if vertices are adjacent, otherwise None
- incident_edges(self, v, outgoing=True)
- returns a generator object of incident edges for a vertex O(m), m connected vertices
:param v: vertex
:param outgoing: type
:return: generator object
- insert_edge(self, u, v, x=None)
- Inserts edge in O(1)
:param u: vertex 1
:param v: vertex 2
:param x: edge weight
:return: None (can raise exceptions)
- insert_vertex(self, v)
- Inserts lone vertex, exception on already existing vertex, in O(1)
:param v: vertex
:return: vertex
- is_directed(self)
- O(1)
:return:
- remove_edge(self, e)
- Removes given edge in O(1)
:param e: edge
:return: None (method can raise exceptions)
- remove_edge_uv(self, u, v)
- removes edge by given vertices, in O(1)
:param u: vertex 1
:param v: vertex 2
:return: None (method can raise exceptions)
- remove_vertex(self, v)
- Removes all edges on given vertex and the vertex itself, in O(m), m connected edges
:param v: vertex
:return: None
- vertex_count(self)
- vertices(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- Edge = <class 'graph.Graph.Edge'>
|