AdjacencyLists extends and realises the abstract class
Representation.
AdjacencyLists stores the state of vertices and arcs as a list of
lists. The arc (i,j) is represented by the list at element i containing
the value j.
|
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
|
|
|
removeVertex(self,
i)
This method deletes the record of vertex labelled i, and all arcs
connected to it. |
source code
|
|
|
addArc(self,
i,
j)
Records that in this state there is an arc from vertex with label i
to vertex with label j |
source code
|
|
|
removeArc(self,
i,
j)
Removes a directional connection from vertex i to vertex j, from the
state of this representation if it exists. |
source code
|
|
boolean
|
isArc(self,
i,
j)
Returns True if and only if there is an arc connecting i to j. |
source code
|
|
number Raises: ValueError if no such label i exists.
|
degree(self,
i)
Returns the number of vertices to which vertex i connects |
source code
|
|
number
|
|
list
|
neighbours(self,
i)
Returns an iterable collection of all the vertices to which the
vertex with index i connects |
source code
|
|
number
|
|
number
|
size(self)
Returns the number of arcs in this graph, as an integer. |
source code
|
|
string
|
|
|
read(self,
stream,
defaultConnector)
Sets the state of this representation to the data contained in some
stream s. |
source code
|
|
Inherited from Representation :
selfEdges
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|